Refactor ItemsCrud.svelte to initialize searchQuery with an empty string and update it based on URL parameters using a reactive effect. Update receipt image handling in +page.svelte to define the image URL as a constant for improved readability.
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m37s

This commit is contained in:
eewing
2026-02-19 10:02:49 -06:00
parent 567d7e3e13
commit 115eecc6f3
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -26,7 +26,11 @@
let scanDialogOpen = $state(false); let scanDialogOpen = $state(false);
let editingItem = $state<StackqItem | null>(null); let editingItem = $state<StackqItem | null>(null);
let formWhich = $state<"create" | "update">("create"); let formWhich = $state<"create" | "update">("create");
let searchQuery = $state(searchFromUrl); let searchQuery = $state("");
$effect(() => {
searchQuery = searchFromUrl;
});
const items = $derived(data?.items ?? []); const items = $derived(data?.items ?? []);
const itemsForParent = $derived(data?.itemsForParent ?? []); const itemsForParent = $derived(data?.itemsForParent ?? []);
+1 -1
View File
@@ -76,10 +76,10 @@
</div> </div>
{/if} {/if}
{#if receipt.Image} {#if receipt.Image}
{@const url = imageUrl(receipt)}
<div class="flex gap-2"> <div class="flex gap-2">
<dt class="text-muted-foreground w-24 shrink-0">Image</dt> <dt class="text-muted-foreground w-24 shrink-0">Image</dt>
<dd> <dd>
{@const url = imageUrl(receipt)}
{#if url} {#if url}
<img <img
src={url} src={url}