Fix runtime crash when server returns undefined roles in auth context#2970
Draft
Fix runtime crash when server returns undefined roles in auth context#2970
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Copilot
AI
changed the title
[WIP] Fix storybook errors
Fix runtime crash when server returns undefined roles in auth context
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Storybook (Chromatic build #6892) reported 24 component errors caused by a null-safety gap in the auth context:
ctx.roles.forEach(...)throws when the/whoamiresponse omitsroles.Changes
src/context/index.ts— Guard againstnull/undefinedroles increateAuthorizer:src/components/Authentication/Kratos/KratosAuthContextProvider.tsx— Add an explicit!payloadguard before accessingpayload.userand callingcreateAuthorizer(payload), covering the edge case whereisLoadingisfalsebutpayloadis still undefined (e.g. query not yet resolved):Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1208/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl tnet/tools/grep ate tories.tsx /usr/bin/grep grep(dns block)storybook.js.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/flanksource-ui/flanksource-ui/node_modules/.bin/storybook build --output-dir /tmp/storybook-build(dns block)/home/REDACTED/work/_temp/ghcca-node/node/bin/node node node_modules/.bin/storybook dev --port 6006 --no-open(dns block)www.chromatic.com/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either: