Debian Codegraph @

frontend/src/reports/route.svelte.ts

raw
1 /** Create a reactive props proxy to allow updating of props. */
2 export function updateable_props<T extends Record<string, unknown>>(
3 raw_props: T,
4 ): [props: T, update: (v: T) => void] {
5 // TODO: this makes it deeply reactive, which adds unnecessary overhead
6 const props = $state(raw_props);
7 return [
8 props,
9 (new_props) => {
10 Object.assign(props, new_props);
11 },
12 ];
13 }