fix(web): silence svelte 5 warnings, add missing enrichment proxy
- Wrap $state initializers that read props (MarketForm, ResearchPanel, maerkte +page) in untrack() so Svelte 5 stops warning about state_referenced_locally. Intent stays "take an initial snapshot of the prop" — the warning existed to make that intent explicit. - Add enrichment/crawl-all-status/+server.ts proxy route; the admin discovery page was polling this path and getting 404s in a tight loop because the equivalent SvelteKit proxy only existed for the plain /crawl-status endpoint.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import Input from '$lib/components/ui/Input.svelte';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
|
||||
import { untrack } from 'svelte';
|
||||
import type { Snippet } from 'svelte';
|
||||
|
||||
interface Props {
|
||||
@@ -39,21 +40,24 @@
|
||||
UA: 'UAH'
|
||||
};
|
||||
|
||||
let selectedCountry = $state(market?.country ?? 'DE');
|
||||
let selectedCountry = $state(untrack(() => market?.country ?? 'DE'));
|
||||
const currency = $derived(currencyByCountry[selectedCountry] ?? 'EUR');
|
||||
|
||||
let hours: OpeningHoursEntry[] = $state(
|
||||
market?.opening_hours?.length ? [...market.opening_hours] : []
|
||||
untrack(() => (market?.opening_hours?.length ? [...market.opening_hours] : []))
|
||||
);
|
||||
|
||||
let admission: AdmissionInfo = $state(
|
||||
market?.admission_info ?? {
|
||||
adult_cents: 0,
|
||||
child_cents: 0,
|
||||
reduced_cents: 0,
|
||||
free_under_age: 0,
|
||||
notes: ''
|
||||
}
|
||||
untrack(
|
||||
() =>
|
||||
market?.admission_info ?? {
|
||||
adult_cents: 0,
|
||||
child_cents: 0,
|
||||
reduced_cents: 0,
|
||||
free_under_age: 0,
|
||||
notes: ''
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
let geocoding = $state(false);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
import type { ResearchResult, FieldSuggestion } from '$lib/api/types.js';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
|
||||
@@ -10,7 +11,7 @@
|
||||
|
||||
let { result, onApply, onClose }: Props = $props();
|
||||
|
||||
let selected: boolean[] = $state(result.suggestions.map(() => true));
|
||||
let selected: boolean[] = $state(untrack(() => result.suggestions.map(() => true)));
|
||||
|
||||
const fieldLabels: Record<string, string> = {
|
||||
description: 'Beschreibung',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { serverFetch } from '$lib/api/client.server.js';
|
||||
import type { RequestHandler } from './$types.js';
|
||||
|
||||
export const GET: RequestHandler = async ({ cookies }) => {
|
||||
try {
|
||||
const res = await serverFetch<unknown>('/admin/discovery/enrichment/crawl-all-status', cookies);
|
||||
return json(res.data);
|
||||
} catch {
|
||||
return json({ error: 'Failed to fetch enrichment status' }, { status: 502 });
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { untrack } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
import Button from '$lib/components/ui/Button.svelte';
|
||||
@@ -6,7 +7,7 @@
|
||||
|
||||
let { data } = $props();
|
||||
|
||||
let searchValue = $state(data.filters.q);
|
||||
let searchValue = $state(untrack(() => data.filters.q));
|
||||
let expandedSeries = $state(new Set<string>());
|
||||
|
||||
const statusLabels: Record<EditionStatus, string> = {
|
||||
|
||||
Reference in New Issue
Block a user