diff --git a/app/web/src/components/Customizer/Customizer.tsx b/app/web/src/components/Customizer/Customizer.tsx index 513220d..866c602 100644 --- a/app/web/src/components/Customizer/Customizer.tsx +++ b/app/web/src/components/Customizer/Customizer.tsx @@ -4,6 +4,7 @@ import { genParams, getParams } from 'src/helpers/cadPackages/jscadParams' const Customizer = () => { const [open, setOpen] = React.useState(true) + const [checked, setChecked] = React.useState(false) const ref = React.useRef() const jsCadCustomizerElement = ref.current const { state } = useIdeContext() @@ -13,13 +14,12 @@ const Customizer = () => { const handleRender2 = ()=>handleRender(getParams(ref.current)) React.useEffect(() => { - console.log({ jsCadCustomizerElement, customizerParams, lastParameters }) - if (jsCadCustomizerElement && customizerParams) { - genParams(customizerParams, jsCadCustomizerElement, lastParameters || {}, (values)=>{ - handleRender(values) - },[]) + if ((jsCadCustomizerElement && customizerParams)) { + genParams(customizerParams, jsCadCustomizerElement, lastParameters || {}, checked ? (values)=>{ + handleRender(values)}: () => {} + ,[]) } - }, [jsCadCustomizerElement, customizerParams, lastParameters]) + }, [jsCadCustomizerElement, customizerParams, lastParameters, checked]) return (
{
Parameters
- +
+ { + const newValue = !checked + if (newValue) handleRender2() + setChecked(newValue)}}/> + +
+
diff --git a/app/web/src/helpers/cadPackages/jsCadController.ts b/app/web/src/helpers/cadPackages/jsCadController.ts index 6178899..4724d78 100644 --- a/app/web/src/helpers/cadPackages/jsCadController.ts +++ b/app/web/src/helpers/cadPackages/jsCadController.ts @@ -103,8 +103,7 @@ export const render: DefaultKernelExport['render'] = async ({ let parameterDefinitions = [] scriptWorker.addEventListener('message', (e) => { const data = e.data - if (data.action == 'parameterDefinitions') { - console.log('message',data) + if (data.action == 'parameterDefinitions') { parameterDefinitions = data.data } else if (data.action == 'entities') { if (data.error) { @@ -123,7 +122,7 @@ export const render: DefaultKernelExport['render'] = async ({ callResolve() } }) - + callResolve() response = null scriptWorker.postMessage({ action: 'init', baseURI, alias: [] }) diff --git a/app/web/src/helpers/hooks/useIdeState.ts b/app/web/src/helpers/hooks/useIdeState.ts index 5ad4dd9..5ce9b7c 100644 --- a/app/web/src/helpers/hooks/useIdeState.ts +++ b/app/web/src/helpers/hooks/useIdeState.ts @@ -180,7 +180,7 @@ export const useIdeState = (): [State, (actionOrThunk: any) => any] => { ...state.objectData, type: payload.objectData?.type, data: payload.objectData?.data, - customizerParams: payload.customizerParams, + customizerParams: payload.customizerParams || state.objectData.customizerParams, lastParameters: payload.lastParameters, }, consoleMessages: payload.message