1
0
Fork 0

hold off drafting till the gist is ready

This commit is contained in:
Enoch Riese 2022-07-16 13:04:00 -04:00
parent 18abd0351a
commit 129647fbdc

View file

@ -33,7 +33,7 @@ const views = {
const hasRequiredMeasurementsMethod = (design, gist) => {
for (const m of design.config.measurements || []) {
if (!gist?.measurements?.[m]) return false
if (!gist.measurements[m]) return false
}
return true
@ -58,6 +58,7 @@ const WorkbenchWrapper = ({ app, design, preload=false, from=false, layout=false
const [popup, setPopup] = useState(false)
const [preloaded, setPreloaded] = useState(false)
// We'll use this in more than one location
const hasRequiredMeasurements = hasRequiredMeasurementsMethod(design, gist)
@ -82,6 +83,7 @@ const WorkbenchWrapper = ({ app, design, preload=false, from=false, layout=false
}
}, [preload, preloaded, from, design])
// Helper methods to manage the gist state
const updateWBGist = useMemo(() => (path, value, closeNav=false) => {
updateGist(path, value)
@ -101,6 +103,9 @@ const WorkbenchWrapper = ({ app, design, preload=false, from=false, layout=false
clear: () => setMessages([]),
}
// don't do anything until the gist is ready
if (!gistReady) {return null}
// Generate the draft here so we can pass it down
let draft = false
if (['draft', 'events', 'test'].indexOf(gist._state?.view) !== -1) {