vite-plugin-vue-devtools icon indicating copy to clipboard operation
vite-plugin-vue-devtools copied to clipboard

perf(utils): useMediaQuery

Open Simon-He95 opened this issue 1 year ago • 3 comments

Simon-He95 avatar Jul 02 '23 16:07 Simon-He95

There is a bug in the current codebase, isSupported need to be called instead of directly used it:

image

Because isSupported is not a reactive variable, so must re-check every time when running the update function.

Please update, thanks!

alexzhang1030 avatar Jul 04 '23 02:07 alexzhang1030

There is a bug in the current codebase, isSupported need to be called instead of directly used it:

image Because `isSupported` is not a reactive variable, so must re-check every time when running the `update` function.

Please update, thanks!

I know it's a bug, I do it in outer const isSupported = (() => window && 'matchMedia' in window && typeof window.matchMedia === 'function')()

so if we use useMediaQuery multiple, we will never call isSupported

Simon-He95 avatar Jul 05 '23 04:07 Simon-He95

There is a bug in the current codebase, isSupported need to be called instead of directly used it: image Because isSupported is not a reactive variable, so must re-check every time when running the update function. Please update, thanks!

I know it's a bug, I do it in outer const isSupported = (() => window && 'matchMedia' in window && typeof window.matchMedia === 'function')()

so if we use useMediaQuery multiple, we will never call isSupported

Yeah, I mean Because isSupported is not a reactive variable, so must re-check every time when running the update function.

alexzhang1030 avatar Jul 05 '23 05:07 alexzhang1030