fix(ui): show warning when live updates disabled due to missing web:read-pulse scope#8262
Conversation
df54bd6 to
afa2625
Compare
|
This looks good, thanks for adding PR for this. |
afa2625 to
50a1a4c
Compare
|
Thanks for the review @lotas! Good catch on the failing test. The WebSocket server was running fine — the issue was that the test was using Fixed by switching to the I also added a separate commit to fix #8261 (webpack-dev-server ECONNRESET crash when proxying the |
| }; | ||
|
|
||
| handleSubscriptionWarningClose = () => { | ||
| this.setState({ subscriptionWarningDismissed: true }); |
There was a problem hiding this comment.
I think this is a good option, if permissions are missing we would show this error in a Snackbar.
User might click close/dismiss and we would save in state that it was dismissed.
So user will not be shown this again (until page is hard refreshed I think)
Probably not an issue for this kind of error 👍
Summary
web:read-pulsescopeAppcomponent and propagate toMainfor displayFixes #8070
Fixes #8261
Problem
When a user (or anonymous visitor) lacks the
web:read-pulsescope, the GraphQL WebSocket connection is silently closed. The UI continues displaying stale data with no indication — task timers count up indefinitely, task states never refresh. The only way to discover this is by inspecting WebSocket traffic in browser devtools.Solution
ui/src/App/index.jsx: In the existingconnectionCallbackthat already catchesInsufficientScopeserrors, addedthis.setState({ subscriptionError: error })to surface the error to the UI. PassessubscriptionErroras a prop toMain.ui/src/App/Main.jsx: Renders a persistent warningSnackbar(amber/warning variant) whensubscriptionErroris present. The banner is dismissible per session and resets on page refresh or user change (sinceMainremounts via itskeyprop).services/web-server/test/graphql/tasks_graphql_test.js: Added test that verifies the WebSocket connection is properly rejected withInsufficientScopeswhen theweb:read-pulsescope is missing. Confirms the server contract the UI fix depends on.Test plan
web:read-pulsescope and refreshing — no banner/auth/roles) do not show the banner