-
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
[Console] Fix editor value resetting at layout change #193516
[Console] Fix editor value resetting at layout change #193516
Conversation
Pinging @elastic/kibana-management (Team:Kibana Management) |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @ElenaStoeva |
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.
Tested locally, all bugs seem to have been patched and all works well again! Nice work @ElenaStoeva!
## Summary This PR fixes the bug where the editor input resets when we resize the page and the layout changes. The following fixes were applied: - The `isVerticalLayout` prop was moved one level down. This removes unnecessary rerendering of the editor when the layout is changed. - Allowed the localstorage value to be undefined. Undefined means that nothing is stored so we should display the default input. If an empty string is stored, we should display an empty editor. - Updates local storage with debounce every time when the editor input is changes. This ensures the editor input is not reset when the editor is rerendered. - Updates the local storage value to `undefined` if it is an empty string when data is being initialized at Main. This ensures that the default input is displayed when we switch between tabs/pages and the input is empty. Before: https://github.com/user-attachments/assets/a0535780-d75a-4df8-9e04-9d34b6f5f4f1 Now: https://github.com/user-attachments/assets/7db46c2c-c35e-461f-99e8-b86c66fb6ae5 --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 3b8e56f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#193834) # Backport This will backport the following commits from `main` to `8.x`: - [[Console] Fix editor value resetting at layout change (#193516)](#193516) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Elena Stoeva","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-24T08:56:47Z","message":"[Console] Fix editor value resetting at layout change (#193516)\n\n## Summary\r\n\r\nThis PR fixes the bug where the editor input resets when we resize the\r\npage and the layout changes. The following fixes were applied:\r\n\r\n- The `isVerticalLayout` prop was moved one level down. This removes\r\nunnecessary rerendering of the editor when the layout is changed.\r\n- Allowed the localstorage value to be undefined. Undefined means that\r\nnothing is stored so we should display the default input. If an empty\r\nstring is stored, we should display an empty editor.\r\n- Updates local storage with debounce every time when the editor input\r\nis changes. This ensures the editor input is not reset when the editor\r\nis rerendered.\r\n- Updates the local storage value to `undefined` if it is an empty\r\nstring when data is being initialized at Main. This ensures that the\r\ndefault input is displayed when we switch between tabs/pages and the\r\ninput is empty.\r\n\r\nBefore:\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/a0535780-d75a-4df8-9e04-9d34b6f5f4f1\r\n\r\n\r\n\r\n\r\nNow:\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/7db46c2c-c35e-461f-99e8-b86c66fb6ae5\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"3b8e56fd34264963bcdbd84110f0cb1fc12651c4","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","v9.0.0","backport:prev-minor","v8.16.0"],"title":"[Console] Fix editor value resetting at layout change","number":193516,"url":"https://github.com/elastic/kibana/pull/193516","mergeCommit":{"message":"[Console] Fix editor value resetting at layout change (#193516)\n\n## Summary\r\n\r\nThis PR fixes the bug where the editor input resets when we resize the\r\npage and the layout changes. The following fixes were applied:\r\n\r\n- The `isVerticalLayout` prop was moved one level down. This removes\r\nunnecessary rerendering of the editor when the layout is changed.\r\n- Allowed the localstorage value to be undefined. Undefined means that\r\nnothing is stored so we should display the default input. If an empty\r\nstring is stored, we should display an empty editor.\r\n- Updates local storage with debounce every time when the editor input\r\nis changes. This ensures the editor input is not reset when the editor\r\nis rerendered.\r\n- Updates the local storage value to `undefined` if it is an empty\r\nstring when data is being initialized at Main. This ensures that the\r\ndefault input is displayed when we switch between tabs/pages and the\r\ninput is empty.\r\n\r\nBefore:\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/a0535780-d75a-4df8-9e04-9d34b6f5f4f1\r\n\r\n\r\n\r\n\r\nNow:\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/7db46c2c-c35e-461f-99e8-b86c66fb6ae5\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"3b8e56fd34264963bcdbd84110f0cb1fc12651c4"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193516","number":193516,"mergeCommit":{"message":"[Console] Fix editor value resetting at layout change (#193516)\n\n## Summary\r\n\r\nThis PR fixes the bug where the editor input resets when we resize the\r\npage and the layout changes. The following fixes were applied:\r\n\r\n- The `isVerticalLayout` prop was moved one level down. This removes\r\nunnecessary rerendering of the editor when the layout is changed.\r\n- Allowed the localstorage value to be undefined. Undefined means that\r\nnothing is stored so we should display the default input. If an empty\r\nstring is stored, we should display an empty editor.\r\n- Updates local storage with debounce every time when the editor input\r\nis changes. This ensures the editor input is not reset when the editor\r\nis rerendered.\r\n- Updates the local storage value to `undefined` if it is an empty\r\nstring when data is being initialized at Main. This ensures that the\r\ndefault input is displayed when we switch between tabs/pages and the\r\ninput is empty.\r\n\r\nBefore:\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/a0535780-d75a-4df8-9e04-9d34b6f5f4f1\r\n\r\n\r\n\r\n\r\nNow:\r\n\r\n\r\n\r\n\r\nhttps://github.com/user-attachments/assets/7db46c2c-c35e-461f-99e8-b86c66fb6ae5\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"3b8e56fd34264963bcdbd84110f0cb1fc12651c4"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Elena Stoeva <[email protected]>
Summary
This PR fixes the bug where the editor input resets when we resize the page and the layout changes. The following fixes were applied:
isVerticalLayout
prop was moved one level down. This removes unnecessary rerendering of the editor when the layout is changed.undefined
if it is an empty string when data is being initialized at Main. This ensures that the default input is displayed when we switch between tabs/pages and the input is empty.Before:
Screen.Recording.2024-09-20.at.08.44.56.mov
Now:
Screen.Recording.2024-09-23.at.12.32.55.mov