mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-05 22:38:48 +00:00
fix: Added a fallback for module context (#13190)
Co-authored-by: Kavin Venkatachalam <kavin.saratha@gmail.com>
This commit is contained in:
parent
cf3fbfc2cb
commit
f6ed13e550
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