mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +00:00
fix: add fallback for useModuleId hook in query panel
Handle case where ModuleContext is not available by wrapping useModuleId in try-catch with 'canvas' fallback
This commit is contained in:
parent
108aa42eea
commit
27ba7dec30
2 changed files with 9 additions and 2 deletions
|
|
@ -267,4 +267,4 @@
|
|||
"jsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,14 @@ export const useQueryPanelKeyHooks = (onChange, value, type) => {
|
|||
const queryPanelHeight = useStore((state) => state.queryPanel.queryPanelHeight);
|
||||
const runQueryOnShortcut = useStore((state) => state.queryPanel.runQueryOnShortcut);
|
||||
const previewQueryOnShortcut = useStore((state) => state.queryPanel.previewQueryOnShortcut);
|
||||
const moduleId = useModuleId();
|
||||
|
||||
// Handle case where ModuleContext is not available
|
||||
let moduleId;
|
||||
try {
|
||||
moduleId = useModuleId();
|
||||
} catch (error) {
|
||||
moduleId = 'canvas'; // Default fallback
|
||||
}
|
||||
const location = useLocation();
|
||||
const { pathname } = location;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue