Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LuMessageSquare, LuShield, LuGitFork } from 'react-icons/lu';

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.


interface NexuModalProps {
open?: boolean;
Expand All @@ -19,15 +20,22 @@ export const NexuModal = memo(({ open: controlledOpen }: NexuModalProps) => {
const [neverShow, setNeverShow] = useState(false);

useEffect(() => {
// Check if user has dismissed the modal before
// Check if user has permanently dismissed the modal
const dismissed = localStorage.getItem(STORAGE_KEY);
if (dismissed === 'true') {
return;
}

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

// Show modal after a short delay
const timer = setTimeout(() => {
setVisible(true);
sessionStorage.setItem(SESSION_KEY, 'true');
logEvent('refly_nexu_workbench_modal_shown');
}, 1000);

Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/en-US/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4995,7 +4995,7 @@ const translations = {
feature1: 'Connect WeChat / Feishu / Slack / Discord',
feature2: 'Runs locally, data stays on your machine',
feature3: 'MIT open source, fork and self-host friendly',
downloadBtn: 'Download nexu',
downloadBtn: 'Get nexu',
neverShow: "Got it, don't show again",
},
guest: {
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/zh-Hans/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5005,7 +5005,7 @@ const translations = {
feature1: '连接微信 / 飞书 / Slack / Discord',
feature2: '本机运行,数据以本机为主',
feature3: 'MIT 开源,可 fork 与自托管',
downloadBtn: ' nexu 下载',
downloadBtn: '前往 nexu',
neverShow: '我已知晓,不再弹出',
},
guest: {
Expand Down
Loading