better code

Massimo Melina committed Jul 4, 2024 at 16:41 UTC fa002756a7827486faf3de8b3e35bc204a32de4c
2 files changed +3 -5
frontend/src/useFetchList.ts
+2 -4
@@ -17,10 +17,8 @@ export function usePath() {
17 }
18
19 // allow links with ?search
20 -waitFor(() => urlParams).then(x => {
21 - if (x)
22 - state.remoteSearch = x.search
23 -})
20 +setTimeout(() => // wait, urlParams is defined at top level
21 + state.remoteSearch = urlParams.search || '')
22
23 export default function useFetchList() {
24 const snap = useSnapState()
src/serveGuiFiles.ts
+1 -1
@@ -115,7 +115,7 @@ async function treatIndex(ctx: Koa.Context, filesUri: string, body: string) {
115 ...newObj(FRONTEND_OPTIONS, (v, k) => getConfig(k)),
116 lang
117 }, null, 4).replace(/<(\/script)/g, '<"+"$1') /*avoid breaking our script container*/}
118 - document.documentElement.setAttribute('ver', '${VERSION.split('-')[0] /*for style selectors*/}')
118 + document.documentElement.setAttribute('ver', HFS.VERSION.split('-')[0])
119 </script>
120 `
121 if (isBody && isOpen)