@uniai-fe/uds-templates 0.3.11 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-templates",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -12,7 +12,7 @@
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
- "packageManager": "pnpm@10.30.3",
15
+ "packageManager": "pnpm@10.32.0",
16
16
  "engines": {
17
17
  "node": ">=24",
18
18
  "pnpm": ">=10"
@@ -86,7 +86,7 @@
86
86
  "@uniai-fe/util-next": "workspace:*",
87
87
  "@uniai-fe/util-rtc": "workspace:*",
88
88
  "eslint": "^9.39.2",
89
- "jotai": "^2.18.0",
89
+ "jotai": "^2.18.1",
90
90
  "next": "^15.5.11",
91
91
  "prettier": "^3.8.1",
92
92
  "react-hook-form": "^7.71.2",
@@ -58,3 +58,12 @@ export const farmIdAtom = atomWithStorage<number>(
58
58
  -1,
59
59
  jotaiStorage.session<number>(),
60
60
  );
61
+
62
+ /**
63
+ * 로그인 사용자 농장 관리번호
64
+ */
65
+ export const farmIdxAtom = atomWithStorage<number>(
66
+ "farmIdx",
67
+ -1,
68
+ jotaiStorage.session<number>(),
69
+ );
@@ -1,4 +1,4 @@
1
- import type { API_Res_Base } from "../../../types/api";
1
+ import type { API_Res_Base } from "@uniai-fe/util-api";
2
2
 
3
3
  /**
4
4
  * 로그인 API; 요청
@@ -34,10 +34,14 @@ export interface API_Res_LoginUserFarm {
34
34
  * 농장명
35
35
  */
36
36
  name: string;
37
+ /**
38
+ * 유니아이 농장 관리번호
39
+ */
40
+ farm_idx: number | string;
37
41
  /**
38
42
  * farm_code (농장 식별번호)
39
43
  */
40
- farm_code: string;
44
+ farm_code: number | string;
41
45
  /**
42
46
  * 계정 권한/직책 코드
43
47
  * - OWNER: 농장주
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { useCallback } from "react";
3
+ import { useCallback, useEffect, useRef } from "react";
4
4
 
5
5
  import { useAtom } from "jotai";
6
6
 
@@ -28,6 +28,12 @@ const ensureDelay = (value?: number): number =>
28
28
  */
29
29
  export function useModal(): UseModalReturn {
30
30
  const [modalStacks, updateModalStack] = useAtom(modalStackAtom);
31
+ const modalStacksRef = useRef(modalStacks);
32
+
33
+ useEffect(() => {
34
+ // 변경 설명: closeModal이 최신 stack 상태를 기준으로 대상을 찾도록 현재 스냅샷 ref를 동기화한다.
35
+ modalStacksRef.current = modalStacks;
36
+ }, [modalStacks]);
31
37
 
32
38
  const newModal = useCallback(
33
39
  <FormContext extends FieldValues>(newStack: ModalState<FormContext>) => {
@@ -87,7 +93,7 @@ export function useModal(): UseModalReturn {
87
93
 
88
94
  const closeModal = useCallback(
89
95
  ({ stackKey, callback }: ModalCloseRequest) => {
90
- const targetStack = modalStacks.find(
96
+ const targetStack = modalStacksRef.current.find(
91
97
  stack => stack.stackKey === stackKey,
92
98
  );
93
99
 
@@ -121,7 +127,7 @@ export function useModal(): UseModalReturn {
121
127
  callback?.();
122
128
  }, resolvedDelay);
123
129
  },
124
- [modalStacks, updateModalStack],
130
+ [updateModalStack],
125
131
  );
126
132
 
127
133
  return { modalStacks, newModal, updateModal, closeModal };