Yuki Takei 11 ماه پیش
والد
کامیت
716c7290ce
2فایلهای تغییر یافته به همراه3 افزوده شده و 10 حذف شده
  1. 3 1
      apps/app/src/states/ui/device.ts
  2. 0 9
      apps/app/src/states/ui/helper.ts

+ 3 - 1
apps/app/src/states/ui/device.ts

@@ -5,11 +5,13 @@ import { Breakpoint } from '@growi/ui/dist/interfaces';
 import { addBreakpointListener, cleanupBreakpointListener } from '@growi/ui/dist/utils';
 import { addBreakpointListener, cleanupBreakpointListener } from '@growi/ui/dist/utils';
 import { atom, useAtom } from 'jotai';
 import { atom, useAtom } from 'jotai';
 
 
+import type { UseAtom } from './helper';
+
 
 
 // Device state atoms
 // Device state atoms
 export const isDeviceLargerThanXlAtom = atom(false);
 export const isDeviceLargerThanXlAtom = atom(false);
 
 
-export const useDeviceLargerThanXl = () => {
+export const useDeviceLargerThanXl = (): UseAtom<typeof isDeviceLargerThanXlAtom> => {
   const [isLargerThanXl, setIsLargerThanXl] = useAtom(isDeviceLargerThanXlAtom);
   const [isLargerThanXl, setIsLargerThanXl] = useAtom(isDeviceLargerThanXlAtom);
 
 
   useEffect(() => {
   useEffect(() => {

+ 0 - 9
apps/app/src/states/ui/helper.ts

@@ -9,12 +9,3 @@ export type UseAtom<AtomType> = AtomType extends PrimitiveAtom<infer Value>
   : AtomType extends Atom<infer Value>
   : AtomType extends Atom<infer Value>
   ? readonly [Value, never]
   ? readonly [Value, never]
   : never;
   : never;
-
-/**
- * 更新関数を実際の値に解決するヘルパー関数
- */
-export const resolveSetStateAction = <T>(newValue: SetStateAction<T>, currentValue: T): T => {
-  return typeof newValue === 'function'
-    ? (newValue as (prev: T) => T)(currentValue)
-    : newValue;
-};