[Bug]: Navbar cmd+click opens new tab but clears app state in original tab #20685

Closed
opened 2026-02-21 20:08:28 -05:00 by yindo · 1 comment
Owner

Originally created by @lequocbinh04 on GitHub (Nov 29, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.10.1

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. Navigate to any app detail page (e.g., /app/{app-id}/configuration)
  2. Hold Cmd (Mac) or Ctrl (Windows/Linux) and click on a navbar link like "Knowledge"
  3. Observe the new tab opens correctly
  4. Switch back to the original tab

✔️ Expected Behavior

The original tab should remain on the app detail page (/app/{app-id}/configuration) with all state intact, while the new tab opens the clicked link.

Actual Behavior

The original tab shows a loading spinner and gets stuck. The app detail state is cleared, making the page unusable.

Image
Originally created by @lequocbinh04 on GitHub (Nov 29, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.10.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. Navigate to any app detail page (e.g., /app/{app-id}/configuration) 2. Hold Cmd (Mac) or Ctrl (Windows/Linux) and click on a navbar link like "Knowledge" 3. Observe the new tab opens correctly 4. Switch back to the original tab ### ✔️ Expected Behavior The original tab should remain on the app detail page (/app/{app-id}/configuration) with all state intact, while the new tab opens the clicked link. ### ❌ Actual Behavior The original tab shows a loading spinner and gets stuck. The app detail state is cleared, making the page unusable. <img width="3008" height="1644" alt="Image" src="https://github.com/user-attachments/assets/e437b56c-6988-43d0-8dd9-ca0a17b3d6f6" />
yindo added the 🐞 bugcloud labels 2026-02-21 20:08:28 -05:00
yindo closed this issue 2026-02-21 20:08:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 29, 2025):

Hi @lequocbinh04! I'm Dosu and I’m helping the dify team.

This bug happens because the navbar's click handler always calls the setAppDetail() function, which clears the app detail state—even when Cmd/Ctrl+click is used to open a link in a new tab. The onClick event fires in the original tab, so the state is reset and the page gets stuck loading, matching what you observed. There’s currently no logic in the navbar code to detect modifier keys and prevent this state clearing when opening links in a new tab, which is why the issue occurs. You can see this in the navbar component code: the onClick handler always runs, regardless of how the link is opened (source).

A possible fix is to update the click handler to check for modifier keys (event.metaKey for Cmd, event.ctrlKey for Ctrl) and skip clearing state if the user is opening the link in a new tab or window. As a temporary workaround, right-clicking the link and choosing "Open in New Tab" may avoid the bug, since it doesn't trigger the onClick handler in the same way.

The relevant code is in web/app/components/header/nav/index.tsx and web/app/components/header/nav/nav-selector/index.tsx, and state is managed with Zustand in web/app/components/app/store.ts (source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 29, 2025): <!-- Greeting --> Hi @lequocbinh04! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This bug happens because the navbar's click handler always calls the setAppDetail() function, which clears the app detail state—even when Cmd/Ctrl+click is used to open a link in a new tab. The onClick event fires in the original tab, so the state is reset and the page gets stuck loading, matching what you observed. There’s currently no logic in the navbar code to detect modifier keys and prevent this state clearing when opening links in a new tab, which is why the issue occurs. You can see this in the navbar component code: the onClick handler always runs, regardless of how the link is opened ([source](https://github.com/langgenius/dify/blob/acbc886ecd578b56a745d9187d1064d3ca3cfd87/web/app/components/header/nav/index.tsx#L10-L97)). A possible fix is to update the click handler to check for modifier keys (event.metaKey for Cmd, event.ctrlKey for Ctrl) and skip clearing state if the user is opening the link in a new tab or window. As a temporary workaround, right-clicking the link and choosing "Open in New Tab" may avoid the bug, since it doesn't trigger the onClick handler in the same way. The relevant code is in `web/app/components/header/nav/index.tsx` and `web/app/components/header/nav/nav-selector/index.tsx`, and state is managed with Zustand in `web/app/components/app/store.ts` ([source](https://github.com/langgenius/dify/blob/acbc886ecd578b56a745d9187d1064d3ca3cfd87/web/app/components/app/store.ts#L1-L54)). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/864ee828-681b-47dd-8311-20bb22018e7d?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20bug%20happens%20because%20the%20navbar%27s%20click%20handler%20always%20calls%20the%20setAppDetail%28%29%20function%2C%20which%20clears%20the%20app%20detail%20state%E2%80%94even%20when%20Cmd/Ctrl%2Bclick%20is%20used%20to%20open%20a%20link%20in%20a%20new%20tab.%20The%20onClick%20event%20fires%20in%20the%20original%20tab%2C%20so%20the%20state%20is%20reset%20and%20the%20page%20gets%20stuck%20loading%2C%20matching%20what%20you%20observed.%20There%E2%80%99s%20currently%20no%20logic%20in%20the%20navbar%20code%20to%20detect%20modifier%20keys%20and%20prevent%20this%20state%20clearing%20when%20opening%20links%20in%20a%20new%20tab%2C%20which%20is%20why%20the%20issue%20occurs.%20You%20can%20see%20this%20in%20the%20navbar%20component%20code%3A%20the%20onClick%20handler%20always%20runs%2C%20regardless%20of%20how%20the%20link%20is%20opened%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/acbc886ecd578b56a745d9187d1064d3ca3cfd87/web/app/components/header/nav/index.tsx%23L10-L97%29%29.%0A%0AA%20possible%20fix%20is%20to%20update%20the%20click%20handler%20to%20check%20for%20modifier%20keys%20%28event.metaKey%20for%20Cmd%2C%20event.ctrlKey%20for%20Ctrl%29%20and%20skip%20clearing%20state%20if%20the%20user%20is%20opening%20the%20link%20in%20a%20new%20tab%20or%20window.%20As%20a%20temporary%20workaround%2C%20right-clicking%20the%20link%20and%20choosing%20%22Open%20in%20New%20Tab%22%20may%20avoid%20the%20bug%2C%20since%20it%20doesn%27t%20trigger%20the%20onClick%20handler%20in%20the%20same%20way.%0A%0AThe%20relevant%20code%20is%20in%20%60web/app/components/header/nav/index.tsx%60%20and%20%60web/app/components/header/nav/nav-selector/index.tsx%60%2C%20and%20state%20is%20managed%20with%20Zustand%20in%20%60web/app/components/app/store.ts%60%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/acbc886ecd578b56a745d9187d1064d3ca3cfd87/web/app/components/app/store.ts%23L1-L54%29%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28936)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20685