Fix #178 ability to restore last backup

This commit is contained in:
Misode
2022-04-08 01:30:14 +02:00
parent ee713cfe00
commit 5d22048bc8
4 changed files with 33 additions and 4 deletions

View File

@@ -1,7 +1,8 @@
import type { DataModel } from '@mcschema/core'
import type { Inputs } from 'preact/hooks'
import { useEffect } from 'preact/hooks'
export function useModel(model: DataModel | undefined | null, invalidated: (model: DataModel) => unknown) {
export function useModel(model: DataModel | undefined | null, invalidated: (model: DataModel) => unknown, inputs?: Inputs) {
const listener = {
invalidated() {
if (model) {
@@ -15,5 +16,5 @@ export function useModel(model: DataModel | undefined | null, invalidated: (mode
return () => {
model?.removeListener(listener)
}
}, [model])
}, [model, ...inputs ?? []])
}