rough-easter-93268
07/07/2025, 6:36 PMrough-easter-93268
07/07/2025, 6:37 PMrough-easter-93268
07/07/2025, 6:38 PMnarrow-agent-26548
07/07/2025, 6:39 PMrough-easter-93268
07/07/2025, 6:39 PMrough-easter-93268
07/07/2025, 6:40 PMnarrow-agent-26548
07/07/2025, 6:40 PMrough-easter-93268
07/07/2025, 6:40 PMrough-easter-93268
07/07/2025, 6:40 PMrough-easter-93268
07/07/2025, 7:24 PMnarrow-agent-26548
07/07/2025, 7:24 PMnarrow-agent-26548
07/07/2025, 7:31 PM/settings/billing) or API keys (/settings/api-keys) pages would redirect users back to the user settings page (/settings/user).
Root Cause
The problem was in the settings.tsx component where the navigation logic was running immediately when the component mounted, before the app configuration was loaded. Since config?.APP_MODE was initially undefined (falsy), the else block would execute and redirect users away from SaaS-only routes like billing and API keys.
Solution
I added a simple guard clause to prevent the navigation logic from running until the config is actually loaded:
React.useEffect(() => {
// Only run navigation logic when config is loaded
if (config?.APP_MODE === undefined) return;
// ... rest of navigation logic
}, [isSaas, pathname, config?.APP_MODE]);
Changes Made
1. Fixed the navigation logic in frontend/src/routes/settings.tsx with a 2-line guard clause
2. Updated useEffect dependencies to include config?.APP_MODE for proper reactivity
3. Updated tests to account for the async config loading behavior
Verification
• All existing tests pass
• Frontend builds successfully
• Pre-commit hooks pass (linting, formatting, type checking)
• The fix maintains existing functionality while solving the refresh redirect issue
Now users can refresh the billing and API keys pages without being unexpectedly redirected to the user settings page.rough-easter-93268
07/07/2025, 7:31 PMrough-easter-93268
07/07/2025, 7:33 PM/billing and /api-keys treated differently than /integrations, /app, and /secrets?
2. Why are both /billing and /credits listed? The Credits tab actually goes to /billing and /credits gives a 404.freezing-spoon-14104
07/07/2025, 8:11 PMrough-easter-93268
07/08/2025, 3:29 PM