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:
@@ -39,18 +39,26 @@
|
|||||||
let {
|
let {
|
||||||
content,
|
content,
|
||||||
summary = $bindable(),
|
summary = $bindable(),
|
||||||
model = $bindable('dgrzone-deepseek-8b-quick'),
|
model = $bindable(),
|
||||||
baseUrl = $bindable('https://ai.dgrzone.com/api'),
|
baseUrl = $bindable(),
|
||||||
token = $bindable(''),
|
token = $bindable(),
|
||||||
systemPrompt = $bindable('You are a helpful assistant.'),
|
systemPrompt = $bindable(),
|
||||||
maxTokens = $bindable(512),
|
maxTokens = $bindable(),
|
||||||
temperature = $bindable(0.7),
|
temperature = $bindable(),
|
||||||
onSave,
|
onSave,
|
||||||
onSyncConfig,
|
onSyncConfig,
|
||||||
buttonClass = "btn btn-sm preset-tonal-primary shadow-lg hover:scale-105 transition-all",
|
buttonClass = "btn btn-sm preset-tonal-primary shadow-lg hover:scale-105 transition-all",
|
||||||
log_lvl = 0
|
log_lvl = 0
|
||||||
}: Props = $props();
|
}: 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
|
// Internal State
|
||||||
let ae_promises: any = $state(null);
|
let ae_promises: any = $state(null);
|
||||||
let show_modal = $state(false);
|
let show_modal = $state(false);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
content = 'test test test test',
|
content = 'test test test test',
|
||||||
new_content = $bindable(''),
|
new_content = $bindable(),
|
||||||
editorView = $bindable(), // Exposed for external control
|
editorView = $bindable(), // Exposed for external control
|
||||||
theme_mode = 'light',
|
theme_mode = 'light',
|
||||||
extensions = [],
|
extensions = [],
|
||||||
|
|||||||
Reference in New Issue
Block a user