-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: bypass immer for first evaluation, fixed cloneDeep issue and using mutative instead of immer #38993
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
chore: bypass immer for first evaluation, fixed cloneDeep issue and using mutative instead of immer #38993
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ import type { ControlData, ControlProps } from "./BaseControl"; | |||||||||
| import BaseControl from "./BaseControl"; | ||||||||||
| import type { ToggleGroupOption } from "@appsmith/ads"; | ||||||||||
| import { ToggleButtonGroup } from "@appsmith/ads"; | ||||||||||
| import produce from "immer"; | ||||||||||
| import { create } from "mutative"; | ||||||||||
| import type { DSEventDetail } from "utils/AppsmithUtils"; | ||||||||||
| import { | ||||||||||
| DSEventTypes, | ||||||||||
|
|
@@ -62,7 +62,7 @@ class ButtonTabControl extends BaseControl<ButtonTabControlProps> { | |||||||||
| isUpdatedViaKeyboard, | ||||||||||
| ); | ||||||||||
| } else { | ||||||||||
| const updatedValues: string[] = produce(values, (draft: string[]) => { | ||||||||||
| const updatedValues: string[] = create(values, (draft: string[]) => { | ||||||||||
| draft.push(value); | ||||||||||
| }); | ||||||||||
|
Comment on lines
+65
to
67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Simplify array update logic. Using mutative's -const updatedValues: string[] = create(values, (draft: string[]) => {
- draft.push(value);
-});
+const updatedValues: string[] = [...values, value];📝 Committable suggestion
Suggested change
|
||||||||||
|
|
||||||||||
|
|
||||||||||
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.
@vsvamsi1 Is immer still required in dependencies ?
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 have left it in the devDependendices not in the dependencies because there were cypress testcases using it. This won't show up on the client prod build. I tried substituting them in the cypress testcases with mutative, however im seeing some errors accessing the mutative packages in cypress commands. I will reach out to @sagar-qa007 to help resolve this and remove them completely. This part of it can be resolved in a separate PR.
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.
Sounds good. We can merge the changes for now. I have also added a backlog item for it here
What kind of error are we facing ?
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 mutative updates were getting ignored and all feature flag interception logic was not working. So all test cases are failing prematurely at the sidebar assertion itself. I thought it was headless chrome running these test cases does not support proxy, however the reducer updates using mutative were working. It seems specific cypress commands.
cc @sagar-qa007