How do I make the element and schema more reactive? I want the schema to be updated…
- User
How do I make the element and schema more reactive? I want the schema to be updated using the loadSchema function every time the element changes. Use svelte 5 runes.
const { elementId } = $props<{ elementId: string }>();
const store = $derived(get(engineStore));
let element = $derived(store.elements.find(el => el.id === elementId));
let schema = $derived(() => { if (element) { return loadSchema(element.type, element.data?.components ?? []); } return null; });
Assistant
Here's an improved version using Svelte 5 runes to make the schema react to any changes in the element:
javascript
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.