Repository navigation
fix(pm-aggregator): /alerts push panel load-order race + server-rendered saved prefs (#3676) - #3745
Merged
Merged
Conversation
…w, render saved prefs server-side (#3676) Drew 2026-11-01: pushes worked while the page said "not supported", and a saved quiet-hours-off reloaded as on. Root cause: the inline page script runs during parsing while push-client.js loads with defer, so window.pmPush did not exist at the first refreshStatus() — the old code read that absence as an incapable browser, painted the unsupported guide, and returned before applying saved prefs. The save itself always persisted (verified in alerts.push_subscriptions). Fixes: capability checked against window directly (PushManager/Notification/serviceWorker); pmPush awaited with a bounded poll; the push form initial state is server-rendered from the newest stored subscription (checkbox states, quiet window, disabled time inputs); prefs lookup falls back to the single stored subscription when the endpoint has rotated; Save preferences confirms in place with the saved values in words instead of reloading. 7 new render tests; alerts suite 29/29. Full suite: 2 failures that also fail on unmodified origin/main (slice3 routes, snapshot-lock timing).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Drew 2026-11-01, live on his phone: pushes arrive, but the /alerts page says push is not supported, and a saved quiet-hours-off reloads as on.
Root cause: the inline page script runs during parsing; push-client.js loads with
defer, sowindow.pmPushdoes not exist yet at the firstrefreshStatus(). The old code treated that absence as an incapable browser — painted the unsupported guide and returned beforeapplyPrefscould run. Click-time actions (Enable, Save, test) worked because by then the deferred script had loaded, and the save itself always persisted (verified:alerts.push_subscriptions.quiet.enabled=false, last_seen at his save).Fixes:
PushManager/Notification/serviceWorker);pmPushawaited with a bounded poll before use.Tests: 7 new render tests in test/alerts.test.ts (alerts suite 29/29). Full suite 887 pass / 2 fail — both failures reproduce on unmodified origin/main (slice3 routes; snapshot-lock timing under load).
Need help on this PR? Tag
@codesmith-botwith what you need.