hold off drafting till the gist is ready
This commit is contained in:
parent
18abd0351a
commit
129647fbdc
1 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue