Closed kbecciv closed 1 year ago
Triggered auto assignment to @jliexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are β
)The issue here is each ReportActionItem
displays an error even if the report is invalid, in which case only one error is sufficient.
The problem is we are displaying the error without checking if the report is valid or not in the code below.
To fix this, we simply check if the report is valid and use it to decide whether to display error messages or not.
const isReportValid = !lodashGet(this.props.report, 'errorFields.addWorkspaceRoom') && !lodashGet(this.props.report, 'errorFields.createChat');
<OfflineWithFeedback
onClose={() => ReportActions.clearReportActionErrors(this.props.report.reportID, this.props.action)}
pendingAction={this.props.draftMessage ? null : this.props.action.pendingAction}
errors={this.props.action.errors}
shouldShowErrorMessages={isReportValid} // Added this line
errorRowStyles={[styles.ml10, styles.mr2]}
needsOffscreenAlphaCompositing={this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU}
>...</OfflineWithFeedback>
error
field in failureData
if a new report is being created but failed and create a forceOpacity
prop in the OfflineWithFeedback
component to force the opacity effect.error
field's timestamp to null
and render the error message if it is not null
.cc @yuwenmemon would you be bale to handle this one since it seems like related to your PR, thanks!
Not overdue, waiting on input from @yuwenmemon
Not overdue, waiting on Yuwen's input
@therealsujitk's proposal seems good to me.
Job added to Upwork: https://www.upwork.com/jobs/~0136c6f52250bef4a6
Current assignee @jliexpensify is eligible for the External assigner, not assigning anyone new.
π£ @therealsujitk You have been assigned to this job by @yuwenmemon! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External
)
Current assignee @yuwenmemon is eligible for the External assigner, not assigning anyone new.
Invited @parasharrajat , @therealsujitk - can you share your Upworks profile?
Sure, [redacted]
@parasharrajat & @yuwenmemon, I'm not sure if you were notified of my mention in the PR since you aren't assigned to it yet. Can you kindly take a look at the suggested changes I've made in my PR and if I should go through with it. I'd like to get your opinion before the weekend so there's time for you to review the PR by monday.
I will check this today.
Just a reminder to check the comments in the PR before the weekend if possible π, sorry to be a bother.
@therealsujitk If you take the PR out of the draft then it will automatically assign us. Just a note for the future!
I tested this but I couldn't put my head around the problem completely and the solution. At this stage, I might be delaying this PR. I request to reassign to another C+. I am busy with other PRs. Hope that is fine.
@yuwenmemon
Will take this one!
π£ @s77rt You have been assigned to this job by @yuwenmemon! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Let's start over again. @s77rt you made a great point in the original PR about fixing the failure data. @therealsujitk does this make sense to you?
Personally it doesn't due to the reasons I've started here - https://github.com/Expensify/App/pull/19188#issuecomment-1555363608, I feel it's not the right way from a UI/UX perspective (I feel the component should be greyed out in this case, i.e. the alpha effect). Maybe we can get someone who did the UI to confirm?
However, It's still an option so if you really want it this way we can proceed. I did add it as an alternate solution to my proposal after all.
@therealsujitk Thanks for the quick follow up. You make a good point regarding the opacity, we should keep that but without showing an error. This may requires changes to OfflineWithFeedback.
Another option is to not keep the report actions at all, i.e. if we make a request to create a chat report and a report action but this failed, then we can just show the chat with an error and not show the report action at all (update failureData to null).
I think we should look after option one as it's the closest to the current behaviour but we may check option two with the team if we think it's better.
This may requires changes to OfflineWithFeedback.
Sure, this can be done too. I thought of that but realised using the existing report errors was a much easier solution (which is what I did in the closed PR, plus any relevant errors may be useful for debugging an issue that comes up in future, maybe an error that occurred different from the create error). Which solution do you think is better?
If we do decide to make changes to OfflineWithFeedback
, any prop names in mind?
Another option is to not keep the report actions at all, i.e. if we make a request to create a chat report and a report action but this failed, then we can just show the chat with an error and not show the report action at all (update failureData to null).
This I'm not so sure about, there may be information that the user would want to refer to, for example if he/she wants to know the IOU amount that failed or the IOU description. Or if they typed a really really long message and we just erased it for them.
Let's confirm with @yuwenmemon before proceeding.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@therealsujitk
plus any relevant errors may be useful for debugging an issue that comes up in future
I don't think we should optimise for cases that may never exist. I doubt the errors will be useful in anyway so let's not create them.
If we do decide to make changes to OfflineWithFeedback, any prop names in mind?
Does not matter. This is a PR thing.
You can explore any other options you see fit and not necessary the outlined two above.
@yuwenmemon @s77rt @jliexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
We had an accepted proposal but we are looking for a possible better alternative.
@yuwenmemon waiting to hear your thoughts on this, currently the best way would be to modify OfflineWithFeedback
with a forceError
prop and remove the error from errorFields
.
Not overdue. Waiting for proposals...
Not overdue. Still looking for proposals...
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@yuwenmemon @s77rt @jliexpensify this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!
Still looking for proposals...
Hmmm... @therealsujitk why can't we fix this by updating the optimistic/success/failure data for the request?
@yuwenmemon we can, that's the alternative solution.
error
field in failureData
where it's not required to remove redundant errors.OfflineWithFeedback
to force the opacity effect because that's the right behaviour (Component should have the effect if the API request failed or hasn't succeeded yet).My original proposal didn't remove the failureData
and simply set shouldShowErrorMessages
to false
which gave the same result but was a much easier solution.
@s77rt What do you think?
@therealsujitk How would the new prop be used? i.e. when to pass the prop?
Another alternative solution, can we just update the errors field to something like an empty object? so technically we have an error but no errors message? This will trigger the opacity but show no message. (May not be the best idea but I think that would work too and it's not hard to work on)
@therealsujitk How would the new prop be used? i.e. when to pass the prop?
I was thinking we could use a forceOpacity
optional prop (default: false
) and use that prop in the line below.
const needsOpacity = (isOfflinePendingAction && !isUpdateOrDeleteError) || isAddError || props.forceOpacity;
This prop would be set to true
if the report has a errorFields.createChat
.
Another alternative solution, can we just update the errors field to something like an empty object? so technically we have an error but no errors message? This will trigger the opacity but show no message. (May not be the best idea but I think that would work too and it's not hard to work on)
This wouldn't work without modifying OfflineWithFeedback
again because we check if error
is empty and not undefined
or null
.
@s77rt btw, what is the downside to keeping the error field?
@therealsujitk That approach is equally complex as the first one. This works it's okay but I would really prefer to avoid that as it would lead to two control points (set the error, decide if the error should be shown). I'm looking to do this implicitly by just controlling one thing and that is the errors field. Can we just set the error message to an empty string?
errors: null
No error message and no opacity reductionerrors: [timestamp: '']
No error message but apply opacity reduction (We are looking for this)errors: [timestemp: 'message']
Error message and apply opacity reduction@yuwenmemon Thoughts here?
Can we just set the error message to an empty string?
This would also require some modifications to OfflineWithFeedback
, otherwise it'll just show a red dot and a close button with no message.
@therealsujitk Sure but it won't be much changes in OfflineWithFeedback
we will just check if the error message is not empty not to render DotIndicatorMessage
, etc. Do you think this is a better approach? if so, can you please update your proposal.
@s77rt I've added it to my proposal, to check for a valid error message something like this will have to be done.
_.empty(Object.values(props.action.error || {}).filter(e => e != null))
It'll also be safer to pass a filtered object to DotMessageIndicator
. All options will require quite a few changes.
I think we can work on that in the PR.
Let's wait for @yuwenmemon thoughts on https://github.com/Expensify/App/issues/18839#issuecomment-1577306110
error
fields in failureData
#19188 (comment).OfflineWithFeedback
's shouldShowErrorMessages
prop to false
in ReportItem
if lodashGet(this.props.report, 'errorFields.createChat')
exists.error
fields in failureData
where it could be redundant.OfflineWithFeedback
to take a forceOpacity
optional prop which will be set to true
in ReportItem
if lodashGet(this.props.report, 'errorFields.createChat')
exists.
const needsOpacity = (isOfflinePendingAction && !isUpdateOrDeleteError) || isAddError || props.forceOpacity;
error
fields in failureData
to { [timestamp]: null }
to set an error with no message.OfflineWithFeedback
to show only valid error messages.
const errors = _.omit(props.errors, v => v !== null);
const hasErrorMessages = !_.isEmpty(errors);
Not overdue! Waiting on @yuwenmemon
While waiting for @yuwenmemon
@therealsujitk I have a question regarding method 3, can we just do:
const hasErrorMessages = hasErrors && _.some(props.errors);
@s77rt yes this would work, I've never used the underscore library before so I wasn't aware of this. The reason I did it that way is because we need to pass a filtered object (object with no null
values) down to DotIndicatorMessage
. I've updated the summary to use a function from underscore which makes it look a lot cleaner.
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
PR https://github.com/Expensify/App/pull/18328 says "We shouldn't need to use a generic error message for failure data for the request money / send money flow when creating a New Chat, just like split bill. Otherwise, it will just be redundant with the error sent by the API.". And step 8 of the PR says "Make sure there is no "Unexpected error" below the IOU" (second error message). In scenario above (steps) as chat is invalid then no need for second redundant message under IOU
Actual Result:
Second redundant "unexpected error" message under IOU is displayed. is redundant, he second error message under IOU is redundant as chat is invalid and will be deleted.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.13.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/93399543/32da3c48-f47e-4552-a251-2ba1afb49000
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit