-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show comment API errors with OfflineWithFeedback
#10317
Conversation
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
OfflineWithFeedback
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, { | ||
optimisticReportActionIDs: [], | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of an MVP solution that I'm removing now. If we leave it in each time the report actions are fetched we will remove any "optimistic actions". That includes any pending actions with errors which breaks the new design. It was always the plan to remove this code so if we end up with a problem related to "stuck actions" then we'll just need to approach it another way. Though, I'm not sure if "stuck comments" are really a thing anymore.
I think this is almost ready. This is what the errors look like atm: cc @shawnborton to see if there are any notes! |
Looks pretty good! Make sure the right side of the error block also has 20px padding, so that the right icon aligns well with the content above and below it. Also, is this nested within the message above it? As in, if you hover over the message row with the error, does the row highlight color show behind the error as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
/** Additional style object for the error row */ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
errorStyle: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: How about errorRowStyle
?
@@ -581,7 +600,7 @@ function getOptions(reports, personalDetails, activeReportID, { | |||
const login = (Str.isValidPhone(searchValue) && !searchValue.includes('+')) | |||
? `+${countryCodeByIP}${searchValue}` | |||
: searchValue; | |||
userToInvite = createOption([login], personalDetails, null, reportsWithDraft, { | |||
userToInvite = createOption([login], personalDetails, null, reportsWithDraft, reportActions, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the case for creating an option when searching for a user to chat with. Are we planning to add a brickRoadIndicator here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but I don't have any specific concerns with passing the reportActions
here. We could create a more specific createReportOption()
alternatively, but unsure whether it's necessary.
@@ -59,10 +59,6 @@ const allReports = {}; | |||
let conciergeChatReportID; | |||
const typingWatchTimers = {}; | |||
|
|||
// Map of optimistic report action IDs. These should be cleared when replaced by a recent fetch of report history | |||
// since we will then be up to date and any optimistic actions that are still waiting to be replaced can be removed. | |||
const optimisticReportActionIDs = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: It looks like we weren't really using optimisticReportActionIDs
so removing this is fine. How were we using these before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were:
- adding all optimistic actions
clientID
to an array on each report object - removing them later when one of these things happens (whichever one happens first):
- The real action created in the server shows up in Pusher
- The latest actions for the report are fetched
Clearing out the actions was done to take care of an edge case where:
- A report comment would fail to be created in the server
- No error message would be displayed and there would be no way to dismiss the message
- These comments would get "stuck" in a kind of limbo of never being created and unable to be removed
- So to counteract that we would clear these out when fetching new actions
Ultimately, I think this is not as much of a problem any more since we are handling the failure cases and giving the user a way to dismiss a message that could not be created for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks for the explanation.
Yeah so I'm not too sure what exactly is happening with the tooltip tbh. Tried switching from margin to padding to see if that helped. Here's what this looks like with improved spacing on the right side and everything under the "hover" Unsure if this is a blocker or something we might improve later, but here's some feedback...
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not entirely clear that the "Close" button will remove the message. Should it say something like "Delete Comment" instead? Do we care?
I think it's fine. If this command fails I suspect the error message will give some context that will make it clear that the message was not sent / saved.
The x feels a bit far from the error message on desktop and having an x in the bottom right corner sort of betrays my expectations (x usually in the top right or left to close or dismiss something).
Yeah, it doesn't look super great, but that's only the case for very large screen sizes. I think it looks pretty good on a laptop sized screen or smaller. The hover actions like "copy to clipboard" are also pushed to the far right side and we seem to be okay with that.
Also, the tooltip looks different now and I think it's satisfactory at this point. We can always make small tweaks in the future.
I'll approve but I'm curious to hear what @shawnborton thinks before we merge.
Both the tooltip and the "x" being far off to the right are totally cool with me, so I'm good with merging this. |
0858736
OfflineWithFeedback
OfflineWithFeedback
I'm gonna merge this one to unblock @neil-marcellini and @PauloGasparSv. I tested against the staging Web-Expensify and don't think this needs to be on HOLD. |
@marcaaron looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Tests passed |
Details
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/218572
Tests
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
Mobile Web
Desktop
iOS
Android