fix: file show: details are not updated when switching to other file

Massimo Melina committed Jul 26, 2023 at 16:19 UTC daf6264c2312868f1a3282d5e3e4b458c3c12bbe
2 files changed +2 -2
frontend/src/components.ts
+1 -1
@@ -69,7 +69,7 @@ export function Select({ onChange, value, options, ...props }: SelectProps) {
69 export function Html({ code, ...rest }: { code:string } & HTMLAttributes<any>) {
70 return !code ? null : h('span', { ...rest, ref(x) {
71 if (x)
72 - x.append(document.createRange().createContextualFragment(code))
72 + x.replaceChildren(document.createRange().createContextualFragment(code))
73 } })
74 }
75
frontend/src/show.ts
+1 -1
@@ -39,7 +39,7 @@ export function fileShow(entry: DirEntry) {
39 h(FlexV, { gap: 0, alignItems: 'stretch' },
40 h('div', { className: 'bar' },
41 h('div', { className: 'filename' }, cur.n),
42 - h(EntryDetails, { entry, midnight: useMidnight() }),
42 + h(EntryDetails, { entry: cur, midnight: useMidnight() }),
43 h(Flex, {},
44 useWindowSize().width > 1280 && iconBtn('?', () => window.open(WIKI_URL + 'File-show')),
45 iconBtn('menu', ev => openFileMenu(cur, ev, ['open','delete'])),