-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Fix view picker small bugs #16987
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
Fix view picker small bugs #16987
Conversation
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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method 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.
1 issue found across 15 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/modules/views/hooks/internal/useUpdateView.ts">
<violation number="1" location="packages/twenty-front/src/modules/views/hooks/internal/useUpdateView.ts:60">
P1: Missing rollback on mutation failure. The optimistic update is applied before the mutation (lines 31-38), but if the mutation fails, the state is never reverted to its original value. This causes UI/backend desync where the user sees the optimistic change but the backend has the original data.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| status: 'successful', | ||
| response: result, | ||
| }; | ||
| } catch (error) { |
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.
P1: Missing rollback on mutation failure. The optimistic update is applied before the mutation (lines 31-38), but if the mutation fails, the state is never reverted to its original value. This causes UI/backend desync where the user sees the optimistic change but the backend has the original data.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/views/hooks/internal/useUpdateView.ts, line 60:
<comment>Missing rollback on mutation failure. The optimistic update is applied before the mutation (lines 31-38), but if the mutation fails, the state is never reverted to its original value. This causes UI/backend desync where the user sees the optimistic change but the backend has the original data.</comment>
<file context>
@@ -0,0 +1,84 @@
+ status: 'successful',
+ response: result,
+ };
+ } catch (error) {
+ if (error instanceof ApolloError) {
+ handleMetadataError(error, {
</file context>
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:3090 This environment will automatically shut down when the PR is closed or after 5 hours. |
| @@ -91,39 +88,6 @@ export const usePersistView = () => { | |||
| ], | |||
| ); | |||
|
|
|||
| const updateView = useCallback( | |||
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.
I would leave it in usePersistView
Current naming convention:
- persistViewFilter = create, update, delete in backend
- saveViewFilter = transform the recordFilters to viewFilters and call persistViewFilter
- remove / upsertRecordFilter = update record filters
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.
New naming proposal:
- performViewFilterAPICreate / performViewFilterAPIUpdate / performViewFilterAPIUpdate viewFilter => wrapping of api calls
- saveRecordFiltersToViewFilters
- upsert / remove recordFilter => update recordFilters state
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.
so this hook should performViewAPIUpdate
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.
1 issue found across 28 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts">
<violation number="1" location="packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts:61">
P1: Missing rollback of optimistic update on error. If `updateCoreViewMutation` fails, the UI will still show the optimistically applied changes that weren't persisted to the server. Store the previous state before applying the optimistic update and restore it in the catch block.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| status: 'successful', | ||
| response: result, | ||
| }; | ||
| } catch (error) { |
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.
P1: Missing rollback of optimistic update on error. If updateCoreViewMutation fails, the UI will still show the optimistically applied changes that weren't persisted to the server. Store the previous state before applying the optimistic update and restore it in the catch block.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts, line 61:
<comment>Missing rollback of optimistic update on error. If `updateCoreViewMutation` fails, the UI will still show the optimistically applied changes that weren't persisted to the server. Store the previous state before applying the optimistic update and restore it in the catch block.</comment>
<file context>
@@ -0,0 +1,86 @@
+ status: 'successful',
+ response: result,
+ };
+ } catch (error) {
+ if (error instanceof ApolloError) {
+ handleMetadataError(error, {
</file context>
|
Hey @lucasbordeau! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
This PR solves small bugs around the view picker.
Since core views are not being handled by object metadata items anymore, and that all view logic is plugged on coreViewsState, this PR implemented optimistic effect by upserting into this state.
Fixes #15422
Fixes #16986
Before
Enregistrement.de.l.ecran.2026-01-07.a.15.23.20.mov
After
Enregistrement.de.l.ecran.2026-01-07.a.15.29.09.mov