@nine-lab/nine-mu 0.1.379 โ†’ 0.1.381

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": "@nine-lab/nine-mu",
3
- "version": "0.1.379",
3
+ "version": "0.1.381",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -205,13 +205,37 @@ class NineExceptionHook extends React.Component {
205
205
  // ==========================================
206
206
  // ๐ŸŽฏ 3. ํ•ต์‹ฌ: ์™ธ๋ถ€ ์ฃผ์ž…ํ˜• 404 ๋ผ์šฐํŒ… ๊ธฐ๋Šฅ ํƒ‘์žฌ
207
207
  // ==========================================
208
- export function NineHook({ menuData, views, error404, onCatch, fallback, styles, containerStyle }) {
209
- // ๋‚ด๋ถ€์—์„œ ์ž๋™์œผ๋กœ ๋ผ์šฐํŠธ ๋ฐฐ์—ด ์ƒ์„ฑ (error404 ์ปดํฌ๋„ŒํŠธ ์ „๋‹ฌ)
208
+ export function NineHook({ menuUrl, views, error404, onCatch, fallback, styles, containerStyle }) {
209
+ const [menuData, setMenuData] = useState([]);
210
+
211
+ // ๐ŸŽฏ AI๊ฐ€ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•˜๋ฉด ๋Ÿฐํƒ€์ž„์— ์‹ค์‹œ๊ฐ„ ๋ฐ˜์˜๋˜๋„๋ก ๋™์  fetch ์ฒ˜๋ฆฌ
212
+ useEffect(() => {
213
+ if (!menuUrl) return;
214
+
215
+ const fetchRoutes = async () => {
216
+ try {
217
+ // ์บ์‹œ ๋ฒ„์ŠคํŒ…(?t=...)์„ ์ถ”๊ฐ€ํ•˜๋ฉด AI๊ฐ€ ์ˆ˜์ •ํ–ˆ์„ ๋•Œ ๋ธŒ๋ผ์šฐ์ € ์บ์‹œ๋ฅผ ํƒ€์ง€ ์•Š๊ณ  ์ฆ‰์‹œ ๋ฐ˜์˜๋ฉ๋‹ˆ๋‹ค.
218
+ const response = await fetch(`${menuUrl}?t=${Date.now()}`);
219
+ if (response.ok) {
220
+ const data = await response.json();
221
+ setMenuData(data);
222
+ }
223
+ } catch (e) {
224
+ console.error("[Nine-Library] ๋Ÿฐํƒ€์ž„ ๋ฉ”๋‰ด ๋™๊ธฐํ™” ์‹คํŒจ:", e);
225
+ }
226
+ };
227
+
228
+ fetchRoutes();
229
+
230
+ // ํ•„์š”์‹œ: ์ฃผ์†Œ์ฐฝ popstate๋‚˜ ํŠน์ • ๋ณต๊ตฌ ์ด๋ฒคํŠธ ์‹œ์ ์— ์žฌํ˜ธ์ถœํ•˜๋„๋ก ํŠธ๋ฆฌ๊ฑฐ ์—ฐ๋™ ๊ฐ€๋Šฅ
231
+ }, [menuUrl]);
232
+
233
+ // ๋ฐ์ดํ„ฐ๊ฐ€ ๋กœ๋“œ๋˜๊ธฐ ์ „์—๋Š” ๊ฐ€๋ณ๊ฒŒ ๋กœ๋”ฉ ์ƒํƒœ๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ , ์™„๋ฃŒ๋˜๋ฉด ๋ผ์šฐํ„ฐ ๊ตฌ์ถ•
210
234
  const dynamicRoutes = createDynamicRoutes(menuData, views, error404);
211
235
 
212
236
  return React.createElement(
213
237
  ScreenProvider,
214
- null,
238
+ { menuData },
215
239
  React.createElement(
216
240
  NineExceptionHook,
217
241
  { onCatch, fallback, styles, containerStyle },