mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-22 08:28:35 +00:00
fix: Added a fallback for module context
This commit is contained in:
parent
edf657b659
commit
ace4fe754c
1 changed files with 2 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ export const ModuleProvider = ({ moduleId, isModuleMode, appType, isModuleEditor
|
|||
export const useModuleContext = () => {
|
||||
const context = useContext(ModuleContext);
|
||||
if (!context) {
|
||||
throw new Error('useModuleContext must be used within a ModuleProvider');
|
||||
return { moduleId: 'canvas', isModuleMode: false, isModuleEditor: false };
|
||||
}
|
||||
return context;
|
||||
};
|
||||
|
|
@ -21,7 +21,7 @@ export const useModuleContext = () => {
|
|||
export const useModuleId = () => {
|
||||
const context = useContext(ModuleContext);
|
||||
if (!context) {
|
||||
throw new Error('useModuleId must be used within a ModuleProvider');
|
||||
return 'canvas';
|
||||
}
|
||||
|
||||
return context.moduleId;
|
||||
|
|
|
|||
Loading…
Reference in a new issue