Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
This commit is contained in:
@@ -714,6 +714,7 @@ export default function App() {
|
|||||||
// Create a setView function for useChat hook - we'll use window.history instead of navigate
|
// Create a setView function for useChat hook - we'll use window.history instead of navigate
|
||||||
const setView = (view: View, viewOptions: ViewOptions = {}) => {
|
const setView = (view: View, viewOptions: ViewOptions = {}) => {
|
||||||
console.log(`Setting view to: ${view}`, viewOptions);
|
console.log(`Setting view to: ${view}`, viewOptions);
|
||||||
|
console.trace('setView called from:'); // This will show the call stack
|
||||||
// Convert view to route navigation using hash routing
|
// Convert view to route navigation using hash routing
|
||||||
switch (view) {
|
switch (view) {
|
||||||
case 'chat':
|
case 'chat':
|
||||||
@@ -753,7 +754,10 @@ export default function App() {
|
|||||||
window.location.hash = '#/welcome';
|
window.location.hash = '#/welcome';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
window.location.hash = '#/';
|
console.error(`Unknown view: ${view}, not navigating anywhere. This is likely a bug.`);
|
||||||
|
console.trace('Invalid setView call stack:');
|
||||||
|
// Don't navigate anywhere for unknown views to avoid unexpected redirects
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user