Skip to content

Re-evaluate banner page rules on SPA navigations (Gleap #141664)#126

Open
boehlerlukas wants to merge 1 commit into
masterfrom
gleap/141664-banner-page-rules-spa
Open

Re-evaluate banner page rules on SPA navigations (Gleap #141664)#126
boehlerlukas wants to merge 1 commit into
masterfrom
gleap/141664-banner-page-rules-spa

Conversation

@boehlerlukas

Copy link
Copy Markdown
Contributor

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 (performActions in Gleap.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

  • GleapBannerManager now owns page-rule gating: showBanner stores 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 existing GleapStreamedEvent page listener, same as notifications) hides the banner when the user navigates to an excluded page and re-shows it on allowed ones.
  • User dismissal (banner-close) clears the stored data so navigation can never resurrect a dismissed banner.
  • performActions no longer arrival-gates banners (notifications + banners are render-time gated; modals/surveys/tours unchanged).

Testing

  • New GleapBannerManager.test.js covering: no-rule banners unaffected, hide/re-show across navigations, pending arrival on excluded page, per-URL-change evaluation, dismissal finality.
  • Full suite: 215 tests pass. npm run build succeeds (bundle artifacts included per repo convention).

🤖 Generated with Claude Code

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>
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.

1 participant