mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 23:56:51 +00:00
Fix #178 ability to restore last backup
This commit is contained in:
@@ -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 ?? []])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user