@samitouri / QOSami-HFS / commits / ea9c99d4

better code: solved weird console warning by mui

Massimo Melina committed Feb 21, 2024 at 11:07 UTC ea9c99d4f60124e84e84bb8275675945e8105af1
2 files changed +4 -4
admin/src/mui.ts
+2 -2
@@ -150,8 +150,8 @@ export const IconBtn = forwardRef(({ title, icon, onClick, disabled, progress, l
150 h(icon)
151 )
152 const aria = rest['aria-label'] ?? (_.isString(title) ? title : undefined)
153 - if (disabled)
154 - ret = h('span', { role: 'button', 'aria-label': aria && (aria + ', disabled') }, ret)
153 + // having this span-wrapper conditioned by if(disabled) is causing a strange (harmless?) warning by mui-popper, so we don't
154 + ret = h('span', { role: 'button', 'aria-label': prefix('', aria, disabled && ', disabled') }, ret)
155 if (title)
156 ret = hTooltip(title, aria, ret, tooltipProps)
157 return ret
src/cross.ts
+2 -2
@@ -111,8 +111,8 @@ export function formatSpeed(n: number, options: { digits?: number }={}) {
111
112 }
113
114 -export function prefix(pre:string, v:string|number|undefined|null|false, post:string='') {
115 - return v ? pre+v+post : ''
114 +export function prefix(pre: Falsy | string, v: string | number | undefined | null | false, post: Falsy | string='') {
115 + return v ? (pre||'') + v + (post || '') : ''
116 }
117
118 export function wait<T=undefined>(ms: number, val?: T): Promise<T | undefined> {