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.
This commit is contained in:
@@ -26,7 +26,11 @@
|
||||
let scanDialogOpen = $state(false);
|
||||
let editingItem = $state<StackqItem | null>(null);
|
||||
let formWhich = $state<"create" | "update">("create");
|
||||
let searchQuery = $state(searchFromUrl);
|
||||
let searchQuery = $state("");
|
||||
|
||||
$effect(() => {
|
||||
searchQuery = searchFromUrl;
|
||||
});
|
||||
|
||||
const items = $derived(data?.items ?? []);
|
||||
const itemsForParent = $derived(data?.itemsForParent ?? []);
|
||||
|
||||
@@ -76,10 +76,10 @@
|
||||
</div>
|
||||
{/if}
|
||||
{#if receipt.Image}
|
||||
{@const url = imageUrl(receipt)}
|
||||
<div class="flex gap-2">
|
||||
<dt class="text-muted-foreground w-24 shrink-0">Image</dt>
|
||||
<dd>
|
||||
{@const url = imageUrl(receipt)}
|
||||
{#if url}
|
||||
<img
|
||||
src={url}
|
||||
|
||||
Reference in New Issue
Block a user