fixes
This commit is contained in:
parent
0a2f883761
commit
0ac2f882e7
|
@ -8,7 +8,7 @@
|
||||||
export let id = null
|
export let id = null
|
||||||
export let updateOnChange = true
|
export let updateOnChange = true
|
||||||
export let quiet = false
|
export let quiet = false
|
||||||
export let inputRef: HTMLInputElement | undefined = undefined
|
export let inputRef: HTMLElement | undefined = undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
let focus = false
|
let focus = false
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
let componentsUsingState: ComponentUsingState[] = []
|
let componentsUsingState: ComponentUsingState[] = []
|
||||||
let componentsUpdatingState: ComponentUsingState[] = []
|
let componentsUpdatingState: ComponentUsingState[] = []
|
||||||
let editorValue: string = ""
|
let editorValue: string = ""
|
||||||
let editorError: string | null = null
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
previewStore.requestComponentContext()
|
previewStore.requestComponentContext()
|
||||||
|
@ -40,10 +39,8 @@
|
||||||
if (selectedKey && previewContext.state) {
|
if (selectedKey && previewContext.state) {
|
||||||
// It's unlikely value will ever be populated immediately as preview never has state values on load
|
// It's unlikely value will ever be populated immediately as preview never has state values on load
|
||||||
editorValue = previewContext.state[selectedKey] ?? null
|
editorValue = previewContext.state[selectedKey] ?? null
|
||||||
editorError = null
|
|
||||||
} else {
|
} else {
|
||||||
editorValue = ""
|
editorValue = ""
|
||||||
editorError = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,12 +193,7 @@
|
||||||
throw new Error("No state key selected")
|
throw new Error("No state key selected")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!e.detail) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const stateUpdate = { [selectedKey]: e.detail }
|
const stateUpdate = { [selectedKey]: e.detail }
|
||||||
editorError = null
|
|
||||||
|
|
||||||
previewStore.updateState(stateUpdate)
|
previewStore.updateState(stateUpdate)
|
||||||
previewStore.setSelectedComponentContext({
|
previewStore.setSelectedComponentContext({
|
||||||
|
@ -230,9 +222,6 @@
|
||||||
label="Set temporary value for design preview"
|
label="Set temporary value for design preview"
|
||||||
on:change={handleStateInspectorChange}
|
on:change={handleStateInspectorChange}
|
||||||
/>
|
/>
|
||||||
{#if editorError}
|
|
||||||
<div class="error">{editorError}</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if componentsUsingState.length > 0}
|
{#if componentsUsingState.length > 0}
|
||||||
|
|
Loading…
Reference in New Issue