@samitouri / QOSami-HFS / commits / df24c2b2

better code

Massimo Melina committed May 8, 2025 at 14:38 UTC df24c2b2514f96cfe9a85a96c40e0498efa8765e
4 files changed +3 -11
dev-plugins.md
+1
@@ -635,6 +635,7 @@ This section is still partially documented, and you may need to have a look at t
635 - `log`
636 - `error_log`
637 - `accountRenamed`
638 + - parameters: { from, to }
639 - `pluginDownload`
640 - `pluginUpdated`
641 - `pluginInstalled`
shared/react.ts
-9
@@ -168,15 +168,6 @@ export function useEffectOnce(cb: Callback, deps: any[]) {
168 }, deps)
169 }
170
171 -type FunctionRef<T=HTMLElement> = (instance: (T | null)) => void
172 -export function passRef<T=any>(el: T, ...refs: (MutableRefObject<T> | FunctionRef<T>)[]) {
173 - for (const ref of refs)
174 - if (_.isFunction(ref))
175 - ref(el)
176 - else if (ref)
177 - ref.current = el
178 -}
179 -
171 export function AriaOnly({ children }: { children?: ReactNode }) {
172 return children ? h('div', { className: 'ariaOnly' }, children) : null
173 }
src/perm.ts
+1 -1
@@ -151,7 +151,7 @@ export function renameAccount(from: string, to: string) {
151 a.belongs![idx] = to
152 }
153 accounts.set(as)
154 - events.emit('accountRenamed', from, to) // everybody, take care of your stuff
154 + events.emit('accountRenamed', { from, to }) // everybody, take care of your stuff
155 saveAccountsAsap()
156 return true
157 }
src/vfs.ts
+1 -1
@@ -444,7 +444,7 @@ function renameUnderPath(rename:undefined | Record<string,string>, path: string)
444 return _.isEmpty(rename) ? undefined : rename
445 }
446
447 -events.on('accountRenamed', (from, to) => {
447 +events.on('accountRenamed', ({ from, to }) => {
448 ;(function renameInNode(n: VfsNode) {
449 for (const k of PERM_KEYS)
450 renameInPerm(n[k])