-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Lens] disable auto apply toggle flag strategy #125157
[Lens] disable auto apply toggle flag strategy #125157
Conversation
72d3fbd
to
8e15e08
Compare
dispatch(enableApplyChanges()); | ||
setImmediate(() => dispatch(disableApplyChanges())); // wait for render |
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.
Is this a little hacky?
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.
Perhaps this may incur into race conditions. But the point is still valid, having a nextFrame
function would be really useful here and also elsewhere
@@ -28,6 +28,7 @@ export interface PreviewState { | |||
export interface EditorFrameState extends PreviewState { | |||
activeDatasourceId: string | null; | |||
stagedPreview?: PreviewState; | |||
applyChangesDisabled?: boolean; |
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 the boolean flag we add to the state.
Do I understand this correctly that in this approach we wouldn't be able to have a potential |
Thanks @dej611 and @mbondyra. Great points both here and in Slack. I think it has become clear that the other approach is best because of the capabilities it affords
It also feels less "tricky." I'll move forward with the other approach knowing we've chosen the right path. |
…uto-apply-toggle-flag-strategy
💔 Build FailedFailed CI Steps
Test Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled in files
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Counterpart to #125158.
In this approach, we mark whether changes should be applied by way of a boolean flag in the state.
In some ways, this is simple, but when we want the app to start with auto-apply turned off, the workspace panel has to ignore the setting until the initial render is finished which is a little tricky. Applying changes is also done by way of toggling the setting on and off. This sometimes makes the switch flash a bit.