@uniai-fe/uds-templates 0.4.27 → 0.4.29

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.4.27",
3
+ "version": "0.4.29",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -24,6 +24,9 @@ export interface API_Req_Login {
24
24
  * @property {string} name 농장명
25
25
  * @property {string} farm_code 농장 식별번호
26
26
  * @property {string} user_access_role 계정 권한/직책 코드 (OWNER: 농장주, EMPLOYEE: 농장직원, REGIONAL_MANAGER: 지역소장)
27
+ * @property {string} address 농장주소
28
+ * @property {number} latitude 농장좌표 위도
29
+ * @property {number} longitude 농장좌표 경도
27
30
  */
28
31
  export interface API_Res_LoginUserFarm {
29
32
  /**
@@ -49,6 +52,18 @@ export interface API_Res_LoginUserFarm {
49
52
  * - REGIONAL_MANAGER: 지역소장
50
53
  */
51
54
  user_access_role: string;
55
+ /**
56
+ * 농장 주소
57
+ */
58
+ address: string;
59
+ /**
60
+ * 농장 좌표; 위도
61
+ */
62
+ latitude: number;
63
+ /**
64
+ * 농장 좌표; 경도
65
+ */
66
+ longitude: number;
52
67
  }
53
68
 
54
69
  /**
@@ -23,6 +23,16 @@ export default function useWeatherKorea() {
23
23
  useEffect(() => {
24
24
  if (typeof window === "undefined") return;
25
25
 
26
+ const hasInjectedCoordinate =
27
+ typeof coordinate.address === "string" ||
28
+ coordinate.lat !== null ||
29
+ coordinate.lng !== null;
30
+
31
+ if (!hasInjectedCoordinate) {
32
+ // 변경 설명: 초기 mount에서 coordinate 주입 전에는 geolocation/web API 준비를 시도하지 않는다.
33
+ return;
34
+ }
35
+
26
36
  const nowMoments = getWeatherBaseMoments("now");
27
37
  const forecastMoments = getWeatherBaseMoments("forecast");
28
38
 
@@ -120,12 +120,15 @@ export async function getWeatherGridLocation(
120
120
  latitude: coordinate?.lat ?? null,
121
121
  longitude: coordinate?.lng ?? null,
122
122
  };
123
+ const hasInjectedAddress =
124
+ typeof coordinate?.address === "string" && coordinate.address.trim() !== "";
123
125
 
124
126
  // console.log("[getWeatherLocation] 특정 좌표지정 확인", coordinate);
125
127
 
126
- // 특정 위경도 좌표를 받지 못하는 경우, 현재 사용자 위치로 지정
128
+ // 변경 설명: 서비스가 address만 명시적으로 주입한 경우에는 geolocation fallback을 재시도하지 않는다.
127
129
  if (
128
130
  typeof window !== "undefined" &&
131
+ !hasInjectedAddress &&
129
132
  (typeof coordinate === "undefined" ||
130
133
  geo.latitude === null ||
131
134
  geo.longitude === null)