better deeply reactive mutable derived

This commit is contained in:
Diego Imbert
2025-12-03 14:32:15 +01:00
parent 016002f591
commit 5befaa3caa
2 changed files with 8 additions and 2 deletions
@@ -85,7 +85,10 @@
Database: 'The database where the data is stored.'
}
let tempSettings: DataTableSettingsType = $state($state.snapshot(dataTableSettings))
let tempSettings: DataTableSettingsType = $derived.by(() => {
let s = $state($state.snapshot(dataTableSettings))
return s
})
function removeDataTable(index: number) {
tempSettings.dataTables.splice(index, 1)
+4 -1
View File
@@ -2,7 +2,7 @@
import { untrack } from 'svelte'
import { deepEqual } from 'fast-equals'
import type { StateStore } from './utils'
import { type StateStore } from './utils'
export function withProps<Component, Props>(component: Component, props: Props) {
const ret = $state({
@@ -39,6 +39,9 @@ export type UsePromiseOptions = {
clearValueOnRefresh?: boolean
}
/**
* @deprecated Use `resource` from `runed` instead
*/
export function usePromise<T>(
createPromise: () => Promise<T>,
{ loadInit = true, clearValueOnRefresh = true }: UsePromiseOptions = {}