Re-evaluate banner page rules on SPA navigations (Gleap #141664)#126
Open
boehlerlukas wants to merge 1 commit into
Open
Re-evaluate banner page rules on SPA navigations (Gleap #141664)#126boehlerlukas wants to merge 1 commit into
boehlerlukas wants to merge 1 commit into
Conversation
Banners evaluated page rules only once, at outbound arrival. In SPAs a banner delivered on an allowed page (e.g. a homepage-only 'is' rule) followed the user onto every other page, and a banner arriving on an excluded page was silently consumed without ever being shown. Banners now join notification bubbles in render-time gating: GleapBannerManager keeps the outbound's page rules, shows/hides the banner as the URL changes (checked ~1x/s by the existing page listener), keeps banners pending when they arrive on excluded pages, and treats user dismissal as final. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Customer report (Gleap #141664): a banner restricted to
URL is https://communitise.com/(homepage only) appeared on inner pages like/communities/{id}/feed.Root cause: banner page rules were evaluated once, at outbound arrival (
performActionsinGleap.js). On an SPA, a banner delivered while the user is on an allowed page stays injected forever and follows the user onto excluded pages. The flip side was also broken: a banner arriving while the user is on an excluded page was silently dropped — the server had already marked the outbound as sent, so the user never saw it.Notification bubbles had the exact same bug and were moved to render-time gating for #141052; this PR gives banners the same treatment.
Fix
GleapBannerManagernow owns page-rule gating:showBannerstores the outbound data and only injects the UI when the current URL passes the rules; otherwise the banner stays pending.checkPageRulesForUrl(called ~1x/s by the existingGleapStreamedEventpage listener, same as notifications) hides the banner when the user navigates to an excluded page and re-shows it on allowed ones.banner-close) clears the stored data so navigation can never resurrect a dismissed banner.performActionsno longer arrival-gates banners (notifications + banners are render-time gated; modals/surveys/tours unchanged).Testing
GleapBannerManager.test.jscovering: no-rule banners unaffected, hide/re-show across navigations, pending arrival on excluded page, per-URL-change evaluation, dismissal finality.npm run buildsucceeds (bundle artifacts included per repo convention).🤖 Generated with Claude Code