[PR #32091] fix: prevent full-page loading when switching tabs in app detail #33546

Open
opened 2026-02-21 20:53:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32091

State: open
Merged: No


Summary

Fixes #31171

When switching between tabs (e.g., Orchestrate, API Access, Logs, Overview) in the app detail view, the entire page would flash a full-screen loading spinner. This happened because:

  1. The fetch useEffect had pathname in its dependency array, so every tab switch triggered a re-fetch
  2. Before re-fetching, setAppDetail() was called with no arguments, clearing the app detail state to undefined
  3. The render guard if (!appDetail) then showed the full-page <Loading /> component

Changes

  • Remove pathname from the fetch effect's dependency array ([appId, pathname] -> [appId]): App details only need to be fetched when the appId changes, not on every tab navigation within the same app.
  • Add pathname to the redirection effect's dependency array: The redirection logic (permission checks and mode-based redirects) uses pathname to determine if the user should be redirected. Adding it as a dependency ensures these checks still run correctly when navigating between tabs.

Before

Switching tabs clears appDetail -> full-page loading spinner -> re-fetch -> restore. The entire tab content disappears momentarily.

After

Switching tabs preserves the existing appDetail state. Only the content area updates. No full-page loading flash.

Test plan

  • Open any app in the Dify dashboard
  • Switch between tabs (Orchestrate/Workflow, API Access, Logs, Overview)
  • Verify no full-page loading spinner appears when switching tabs
  • Verify the sidebar navigation remains visible during tab switches
  • Navigate to a different app and verify the loading state still shows correctly on initial load
  • Verify that permission-based redirects still work (non-editor user accessing restricted tabs gets redirected to Overview)
**Original Pull Request:** https://github.com/langgenius/dify/pull/32091 **State:** open **Merged:** No --- ## Summary Fixes #31171 When switching between tabs (e.g., Orchestrate, API Access, Logs, Overview) in the app detail view, the entire page would flash a full-screen loading spinner. This happened because: 1. The fetch `useEffect` had `pathname` in its dependency array, so every tab switch triggered a re-fetch 2. Before re-fetching, `setAppDetail()` was called with no arguments, clearing the app detail state to `undefined` 3. The render guard `if (!appDetail)` then showed the full-page `<Loading />` component ### Changes - **Remove `pathname` from the fetch effect's dependency array** (`[appId, pathname]` -> `[appId]`): App details only need to be fetched when the `appId` changes, not on every tab navigation within the same app. - **Add `pathname` to the redirection effect's dependency array**: The redirection logic (permission checks and mode-based redirects) uses `pathname` to determine if the user should be redirected. Adding it as a dependency ensures these checks still run correctly when navigating between tabs. ### Before Switching tabs clears `appDetail` -> full-page loading spinner -> re-fetch -> restore. The entire tab content disappears momentarily. ### After Switching tabs preserves the existing `appDetail` state. Only the content area updates. No full-page loading flash. ## Test plan - [ ] Open any app in the Dify dashboard - [ ] Switch between tabs (Orchestrate/Workflow, API Access, Logs, Overview) - [ ] Verify no full-page loading spinner appears when switching tabs - [ ] Verify the sidebar navigation remains visible during tab switches - [ ] Navigate to a different app and verify the loading state still shows correctly on initial load - [ ] Verify that permission-based redirects still work (non-editor user accessing restricted tabs gets redirected to Overview)
yindo added the pull-request label 2026-02-21 20:53:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33546