fix: resolve Svelte 5 'props_invalid_value' error by removing defaults from $bindable props

Binding to an undefined value when a $bindable prop has a default fallback causes a runtime error in Svelte 5 runes mode. Defaults are now applied within the component logic.
This commit is contained in:
Scott Idem
2026-01-12 12:50:35 -05:00
parent bb964edfc5
commit 93dd8271eb
2 changed files with 15 additions and 7 deletions

View File

@@ -39,18 +39,26 @@
let {
content,
summary = $bindable(),
model = $bindable('dgrzone-deepseek-8b-quick'),
baseUrl = $bindable('https://ai.dgrzone.com/api'),
token = $bindable(''),
systemPrompt = $bindable('You are a helpful assistant.'),
maxTokens = $bindable(512),
temperature = $bindable(0.7),
model = $bindable(),
baseUrl = $bindable(),
token = $bindable(),
systemPrompt = $bindable(),
maxTokens = $bindable(),
temperature = $bindable(),
onSave,
onSyncConfig,
buttonClass = "btn btn-sm preset-tonal-primary shadow-lg hover:scale-105 transition-all",
log_lvl = 0
}: Props = $props();
// Apply defaults if undefined (Safe for Svelte 5 Runes)
if (model === undefined) model = 'dgrzone-deepseek-8b-quick';
if (baseUrl === undefined) baseUrl = 'https://ai.dgrzone.com/api';
if (token === undefined) token = '';
if (systemPrompt === undefined) systemPrompt = 'You are a helpful assistant.';
if (maxTokens === undefined) maxTokens = 512;
if (temperature === undefined) temperature = 0.7;
// Internal State
let ae_promises: any = $state(null);
let show_modal = $state(false);

View File

@@ -29,7 +29,7 @@
let {
content = 'test test test test',
new_content = $bindable(''),
new_content = $bindable(),
editorView = $bindable(), // Exposed for external control
theme_mode = 'light',
extensions = [],