add customizerParams to state

This commit is contained in:
Kurt Hutten
2021-08-02 23:19:57 +10:00
parent 8883df3445
commit 336501aaff
4 changed files with 38 additions and 9 deletions

View File

@@ -30,6 +30,7 @@ export interface HealthyResponse {
data: any
type: 'stl' | 'png' | 'geometry'
}
customizerParams?: any
}
export function createHealthyResponse({
@@ -37,11 +38,13 @@ export function createHealthyResponse({
data,
consoleMessage,
type,
customizerParams,
}: {
date: Date
data: any
consoleMessage: string
type: HealthyResponse['objectData']['type']
customizerParams?: any
}): HealthyResponse {
return {
status: 'healthy',
@@ -54,6 +57,7 @@ export function createHealthyResponse({
message: consoleMessage,
time: date,
},
customizerParams,
}
}

View File

@@ -108,6 +108,7 @@ self.addEventListener('message', (e)=>worker.postMessage(e.data))
data: [...data.entities.map(CSG2Object3D).filter((o) => o)],
consoleMessage: data.scriptStats,
date: new Date(),
customizerParams: ['param1', 'abc'],
})
}
callResolve()

View File

@@ -89,6 +89,7 @@ export interface State {
type: 'INIT' | 'stl' | 'png' | 'geometry'
data: any
quality: 'low' | 'high'
customizerParams?: any
}
layout: any
camera: {
@@ -153,6 +154,7 @@ export const useIdeState = (): [State, (actionOrThunk: any) => any] => {
...state.objectData,
type: payload.objectData?.type,
data: payload.objectData?.data,
customizerParams: payload.customizerParams,
},
consoleMessages: payload.message
? [...state.consoleMessages, payload.message]
@@ -248,7 +250,7 @@ export const requestRender = ({
quality,
},
})
.then(({ objectData, message, status }) => {
.then(({ objectData, message, status, customizerParams }) => {
if (status === 'error') {
dispatch({
type: 'errorRender',
@@ -257,7 +259,12 @@ export const requestRender = ({
} else {
dispatch({
type: 'healthyRender',
payload: { objectData, message, lastRunCode: code },
payload: {
objectData,
message,
lastRunCode: code,
customizerParams,
},
})
return objectData
}