Skip to content

[ChromeNext] Add a switch to toggle chrome-next in devbar#260952

Merged
Dosant merged 1 commit intoelastic:feature/chrome-nextfrom
Dosant:feature/chrome-next-devtools
Apr 2, 2026
Merged

[ChromeNext] Add a switch to toggle chrome-next in devbar#260952
Dosant merged 1 commit intoelastic:feature/chrome-nextfrom
Dosant:feature/chrome-next-devtools

Conversation

@Dosant
Copy link
Copy Markdown
Contributor

@Dosant Dosant commented Apr 2, 2026

Summary

Screenshot 2026-04-02 at 16 58 32

Note: it is possible to make it work without a page reload, but I thought it was not worth the complexity.

@elasticmachine
Copy link
Copy Markdown
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

Copy link
Copy Markdown
Member

@kowalczyk-krzysztof kowalczyk-krzysztof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally it would be useful if we could have solution switcher somehow working without doing the hard work 😆 but this is good too!

I've been running two Kibanas recently, one on the feature branch, one on main just for solution switcher so see if things don't randomly break in different solutions.

Comment on lines +29 to +33
export const toggleNextChrome = (featureFlags: FeatureFlagsStart): void => {
const next = !isNextChrome(featureFlags);
sessionStorage.setItem(NEXT_CHROME_SESSION_STORAGE_KEY, String(next));
window.location.reload();
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low feature-flags/index.ts:29

toggleNextChrome calls sessionStorage.setItem() without a try-catch, so if sessionStorage is unavailable (e.g., private browsing mode, security restrictions), clicking the toggle throws an uncaught exception. Consider wrapping the setItem call in a try-catch to match the graceful handling in isNextChrome, or at least catch and ignore the error to avoid crashing.

 export const toggleNextChrome = (featureFlags: FeatureFlagsStart): void => {
   const next = !isNextChrome(featureFlags);
-  sessionStorage.setItem(NEXT_CHROME_SESSION_STORAGE_KEY, String(next));
-  window.location.reload();
+  try {
+    sessionStorage.setItem(NEXT_CHROME_SESSION_STORAGE_KEY, String(next));
+    window.location.reload();
+  } catch {
+    // sessionStorage may be unavailable
+  }
 };
🤖 Copy this AI Prompt to have your agent fix this:
In file src/core/packages/chrome/feature-flags/index.ts around lines 29-33:

`toggleNextChrome` calls `sessionStorage.setItem()` without a try-catch, so if `sessionStorage` is unavailable (e.g., private browsing mode, security restrictions), clicking the toggle throws an uncaught exception. Consider wrapping the `setItem` call in a try-catch to match the graceful handling in `isNextChrome`, or at least catch and ignore the error to avoid crashing.

Evidence trail:
src/core/packages/chrome/feature-flags/index.ts lines 17-31 at REVIEWED_COMMIT:
- Lines 17-25: `isNextChrome` has try-catch around `sessionStorage.getItem()` with comment '// sessionStorage may be unavailable'
- Lines 27-31: `toggleNextChrome` calls `sessionStorage.setItem()` at line 29 with no try-catch protection

@Dosant Dosant marked this pull request as ready for review April 2, 2026 15:26
@Dosant Dosant requested a review from a team as a code owner April 2, 2026 15:26
@Dosant Dosant merged commit b9071c3 into elastic:feature/chrome-next Apr 2, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants