Skip to content

fix: nexu modal SPA navigation fix and button text update#2273

Merged
Siri-Ray merged 1 commit intomainfrom
fix/nexu-modal-improvements
Mar 25, 2026
Merged

fix: nexu modal SPA navigation fix and button text update#2273
Siri-Ray merged 1 commit intomainfrom
fix/nexu-modal-improvements

Conversation

@lefarcen
Copy link
Copy Markdown
Contributor

@lefarcen lefarcen commented Mar 25, 2026

Summary

  • Fix nexu modal re-appearing when switching sidebar tabs (SPA navigation). Use sessionStorage to ensure the modal only shows once per browser session, while still showing on actual page refreshes.
  • Rename button text: "Download nexu" → "Get nexu" (en-US), "去 nexu 下载" → "前往 nexu" (zh-Hans).

Test plan

  • Refresh the workspace page — modal should appear once
  • Switch sidebar tabs without refreshing — modal should NOT re-appear
  • Check "Don't show again" and refresh — modal should not appear
  • Verify button text shows "Get nexu" (en) / "前往 nexu" (zh)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Implemented browser session awareness for the Nexu promotion modal, preventing redundant displays of promotional content during a single browsing session.
  • UI Updates

    • Updated button labels in English and Simplified Chinese for the Nexu promotion to enhance clarity and user experience.

…button text

Use sessionStorage to ensure the modal only appears once per browser session,
preventing it from popping up when switching sidebar tabs. Also rename
"Download nexu" to "Get nexu" (en) / "前往 nexu" (zh-Hans).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Added browser-session gating to the Nexu promotion modal using sessionStorage to prevent repeated displays within the same session. Updated accompanying UI translation strings in English and Simplified Chinese for the feature button label.

Changes

Cohort / File(s) Summary
Modal Session Gating
packages/ai-workspace-common/src/components/nexu-promotion/NexuModal.tsx
Introduced SESSION_KEY constant and added sessionStorage check on component mount to gate modal visibility within a single browser session. Modal now writes to sessionStorage when displayed, preventing re-shows until the session ends.
UI Translation Updates
packages/i18n/src/en-US/ui.ts, packages/i18n/src/zh-Hans/ui.ts
Updated translation strings for nexuPromotion.modal.feature3.downloadBtn: English changed from "Download nexu" to "Get nexu"; Simplified Chinese changed from "去 nexu 下载" to "前往 nexu".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • mrcfps
  • Siri-Ray

Poem

🐰 A hop through the sessions, once per browser view,
The modal now bows to the fresh start anew,
With "Get nexu" now gleaming in tongues old and new,
The Nexu promotion stands proud—refreshed through and through! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes both main changes: the SPA navigation fix using sessionStorage and the button text update across multiple languages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nexu-modal-improvements

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying refly-branch-test with  Cloudflare Pages  Cloudflare Pages

Latest commit: 13dd791
Status: ✅  Deploy successful!
Preview URL: https://a485094b.refly-branch-test.pages.dev
Branch Preview URL: https://fix-nexu-modal-improvements.refly-branch-test.pages.dev

View logs

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ai-workspace-common/src/components/nexu-promotion/NexuModal.tsx`:
- Line 11: Replace the sessionStorage-based session tracking with a
module-scoped in-memory boolean so the modal can reappear after a full page
reload: remove uses of SESSION_KEY and any sessionStorage.getItem/setItem in the
NexuModal component and instead introduce a module-level flag (e.g.,
shownThisSession) that is checked/updated by the same logic currently in
NexuModal (the component/handler that reads/writes SESSION_KEY); this flag
should default to false on page load and be set to true when the modal is shown
to prevent repeats during SPA navigation while allowing re-display after a full
refresh.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59079071-1bea-4ac4-9404-629363781958

📥 Commits

Reviewing files that changed from the base of the PR and between ccb1382 and 13dd791.

📒 Files selected for processing (3)
  • packages/ai-workspace-common/src/components/nexu-promotion/NexuModal.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts


const NEXU_URL = 'https://nexu.io';
const STORAGE_KEY = 'nexu_modal_dismissed';
const SESSION_KEY = 'nexu_modal_shown_this_session';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does window.sessionStorage persist across full page reloads in the same tab, and when is it cleared?

💡 Result:

Yes, window.sessionStorage persists across full page reloads in the same tab. It is cleared when the tab or browser window is closed.

Citations:


Replace sessionStorage with an in-memory flag to allow modal re-display on page refresh.

sessionStorage persists across full page reloads within the same tab, so once the modal is marked as shown via sessionStorage.setItem(SESSION_KEY, 'true'), it will not display again even after refresh. Use an in-memory flag instead to reset on each page load while still preventing repeated displays during single-page navigation.

Proposed fix
 const NEXU_URL = 'https://nexu.io';
 const STORAGE_KEY = 'nexu_modal_dismissed';
-const SESSION_KEY = 'nexu_modal_shown_this_session';
+let hasShownInCurrentPageLoad = false;

 interface NexuModalProps {
   open?: boolean;
 }

 export const NexuModal = memo(({ open: controlledOpen }: NexuModalProps) => {
   const [visible, setVisible] = useState(false);

-    // Only show once per browser session (avoid re-showing on SPA navigation)
-    const shownThisSession = sessionStorage.getItem(SESSION_KEY);
-    if (shownThisSession === 'true') {
+    // Only show once per current page load (avoid re-showing on SPA navigation)
+    if (hasShownInCurrentPageLoad) {
       return;
     }

     const timer = setTimeout(() => {
       setVisible(true);
-      sessionStorage.setItem(SESSION_KEY, 'true');
+      hasShownInCurrentPageLoad = true;
       logEvent('refly_nexu_workbench_modal_shown');
     }, 1000);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai-workspace-common/src/components/nexu-promotion/NexuModal.tsx` at
line 11, Replace the sessionStorage-based session tracking with a module-scoped
in-memory boolean so the modal can reappear after a full page reload: remove
uses of SESSION_KEY and any sessionStorage.getItem/setItem in the NexuModal
component and instead introduce a module-level flag (e.g., shownThisSession)
that is checked/updated by the same logic currently in NexuModal (the
component/handler that reads/writes SESSION_KEY); this flag should default to
false on page load and be set to true when the modal is shown to prevent repeats
during SPA navigation while allowing re-display after a full refresh.

@Siri-Ray Siri-Ray merged commit 16ad120 into main Mar 25, 2026
5 checks passed
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.

2 participants