Skip to content
Open
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion src/frontend/src/pages/SettingsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export default function SettingsPage(): JSX.Element {
const autoLogin = useAuthStore((state) => state.autoLogin);
const hasStore = useStoreStore((state) => state.hasStore);

const flowsUrl = `${window.location.origin}/flows`;

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Potential base path issue: use a relative path instead.

Constructing the URL with window.location.origin will fail if the application is deployed under a base path (e.g., example.com/langflow/), as it would navigate to example.com/flows instead of example.com/langflow/flows. Additionally, using a full URL may trigger a full page reload rather than client-side routing.

Apply this diff to use a relative path:

-  const flowsUrl = `${window.location.origin}/flows`;
+  const flowsUrl = "/flows";

Or pass the path directly to the backTo prop:

-  const flowsUrl = `${window.location.origin}/flows`;
-
   // Hides the General settings if there is nothing to show
   const showGeneralSettings = ENABLE_PROFILE_ICONS || hasStore || !autoLogin;

   const sidebarNavItems: {

And update line 94:

     <PageLayout
-      backTo={flowsUrl}
+      backTo="/flows"
       title="Settings"
       description="Manage the general settings for Langflow."
     >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const flowsUrl = `${window.location.origin}/flows`;
@@ src/frontend/src/pages/SettingsPage/index.tsx:18
const flowsUrl = "/flows";
@@ src/frontend/src/pages/SettingsPage/index.tsx:94
backTo="/flows"
🤖 Prompt for AI Agents
In src/frontend/src/pages/SettingsPage/index.tsx around lines 18-19, the code
builds flowsUrl using window.location.origin which breaks when the app is served
under a base path and forces a full-page reload; replace the absolute URL with a
relative path (e.g., '/flows' or just 'flows' as appropriate) and pass that
relative path directly to the backTo prop so client-side routing is used instead
of constructing a full origin-based URL.

// Hides the General settings if there is nothing to show
const showGeneralSettings = ENABLE_PROFILE_ICONS || hasStore || !autoLogin;

Expand Down Expand Up @@ -89,7 +91,7 @@ export default function SettingsPage(): JSX.Element {

return (
<PageLayout
backTo={-1 as To}
backTo={flowsUrl}
title="Settings"
description="Manage the general settings for Langflow."
>
Expand Down
Loading