Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Refactor Creating a Chat to be optimistic #11439
Refactor Creating a Chat to be optimistic #11439
Changes from all commits
08195d0
852132c
8ab056b
856f728
1699c18
ca7581c
f2a824e
0e84d21
407b9d3
d1a12ff
220fa6c
03d91ff
357b113
f5a3dac
b2589b7
2b207bd
3136a2d
036f4ac
09f6711
ae4d03a
c19930a
7a864ff
8a211b9
af65b36
8821c0a
2e01251
545fc3d
0e6d523
7fb11c5
df5942a
d110394
5332999
7dc733b
7f3bd92
1f33629
4769383
1f8964d
c40516b
f53dffa
506cb31
3b722df
8e2ecad
ae29164
b3105f3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we have a way to clear the failed red brick road error here? Like an error is set via PHP but how do you clear the failed created chat?
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.
If the chat creation fails, we make you delete the report from the error so it clears everything from onyx
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.
Don't we need to clean up the create action too?
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.
Child reports do not get deleted here when there is an error because we do not pass
shouldDeleteChildReports
totrue
here. More details here #45625There 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.
I still think we should move this conditional to openReport
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.
The existing comment got dismissed but I will repeat it here. I think that it's confusing to have
openReport
sometimes not open the report, but specifically in this case:https://github.com/Expensify/App/pull/11439/files#diff-f7eec01ae30248000c28c7d3f68c7ea00ba10e5fc64f2854474a350beb2e9556R147
We are passing the (newly created) optimistic report to
openReport
there, and we want it to open in that case. Adding anisOptimistic
flag doesn't really work because sometimes we actually want to open the optimistic report.What we're talking about is passing an
actuallyOpenTheReport
flag toOpenReport
which seems obtuse.We could also just do something like:
Instead of creating this function, but I think having this function in one place is clearer because we can have a single comment explaining it.
But basically, simply knowing whether the report is optimistic or not is not enough information to know if we neeed to open it.
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.
Ah I see, because sometimes we want to create a new optimistic report, and sometimes we have are looking at an optimistic report and therefore we don't need to open it.
openReportIfNecessary
makes sense.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.
Thanks for the additional context. I think that makes sense in this case then.