@nine-lab/nine-mu 0.1.385 โ†’ 0.1.387

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.385",
3
+ "version": "0.1.387",
4
4
  "description": "AI-Driven Full-Stack Code Fabrication Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/nine-mu.umd.js",
@@ -208,20 +208,24 @@ class NineExceptionHook extends React.Component {
208
208
  // ==========================================
209
209
  // ๐ŸŽฏ 3. ์ตœ์ข… ์™„๊ฒฐ: ์ž์‹ ์ปดํฌ๋„ŒํŠธ(children)๋ฅผ ์ˆ˜์šฉํ•˜๋Š” ๊ตฌ์กฐ๋กœ ๋ณ€๊ฒฝ
210
210
  // ==========================================
211
- export function NineHook({ children, menuUrl, views, error404, onCatch, fallback, styles, containerStyle }) {
212
- const [menuData, setMenuData] = useState([]);
211
+ export function NineHook({ menuUrl, views, error404, onCatch, fallback, styles, containerStyle }) {
212
+ const { menuData, setMenuData } = useContext(ScreenContext) || {};
213
+ const [localMenuData, setLocalMenuData] = useState([]);
213
214
 
215
+ // ๋ถ€๋ชจ ์ปจํ…์ŠคํŠธ๊ฐ€ ์—†์„ ๋•Œ๋ฅผ ๋Œ€๋น„ํ•œ ์•ˆ์ „ ์žฅ์น˜ ๋ฐ ์‹ค์‹œ๊ฐ„ fetch
214
216
  const fetchRoutes = async () => {
215
217
  if (!menuUrl) return;
216
218
  try {
217
219
  const response = await fetch(`${menuUrl}?t=${Date.now()}`);
218
220
  if (response.ok) {
219
221
  const data = await response.json();
220
- setMenuData((prev) => {
221
- if (JSON.stringify(prev) === JSON.stringify(data)) return prev;
222
- console.log("๐Ÿ”ฅ [Nine-Library] routes.json ๋ณ€๊ฒฝ ๊ฐ์ง€ -> ์ „์ฒด ์‹œ์Šคํ…œ ๋™๊ธฐํ™”");
223
- return data;
224
- });
222
+
223
+ // ์ „์—ญ Context๊ฐ€ ์žˆ์œผ๋ฉด ๊ฑฐ๊ธฐ์— ์ฐ”๋Ÿฌ๋„ฃ๊ณ , ์—†์œผ๋ฉด ๋กœ์ปฌ ์Šคํ…Œ์ดํŠธ์— ์ €์žฅ
224
+ if (window.setNineMenuDataGlobal) {
225
+ window.setNineMenuDataGlobal(data);
226
+ } else {
227
+ setLocalMenuData(data);
228
+ }
225
229
  }
226
230
  } catch (e) {
227
231
  console.error("[Nine-Library] ๋Ÿฐํƒ€์ž„ ๋ฉ”๋‰ด ๋™๊ธฐํ™” ์‹คํŒจ:", e);
@@ -241,37 +245,24 @@ export function NineHook({ children, menuUrl, views, error404, onCatch, fallback
241
245
  };
242
246
  }, [menuUrl]);
243
247
 
244
- // ๐ŸŽฏ [ํ•ต์‹ฌ ๊ต์ •]: ์ตœ์ดˆ fetch๊ฐ€ ์™„๋ฃŒ๋˜๊ธฐ ์ „(๋ฐ์ดํ„ฐ๊ฐ€ ์—†์„ ๋•Œ)์—๋Š” ๋ Œ๋”๋ง์„ ์ž ์‹œ ๋ฉˆ์ถฅ๋‹ˆ๋‹ค.
245
- if (!menuData || menuData.length === 0) {
246
- return React.createElement(
247
- 'div',
248
- { style: { padding: '25px', color: '#666', fontFamily: 'monospace', background: '#121314', minHeight: '100vh' } },
249
- '>> Initializing menu matrix telemetry...'
250
- );
251
- }
252
-
253
- const dynamicRoutes = createDynamicRoutes(menuData, views, error404);
248
+ const targetData = menuData && menuData.length > 0 ? menuData : localMenuData;
249
+ const dynamicRoutes = createDynamicRoutes(targetData, views, error404);
254
250
 
255
251
  return React.createElement(
256
- ScreenProvider,
257
- { menuData },
252
+ NineExceptionHook,
253
+ { onCatch, fallback, styles, containerStyle },
258
254
  React.createElement(
259
- NineExceptionHook,
260
- { onCatch, fallback, styles, containerStyle },
261
- children,
255
+ Suspense,
256
+ { fallback: React.createElement('div', { style: { padding: '25px', color: '#666', fontFamily: 'monospace' } }, '>> Loading component matrix...') },
262
257
  React.createElement(
263
- Suspense,
264
- { fallback: React.createElement('div', { style: { padding: '25px', color: '#666', fontFamily: 'monospace' } }, '>> Loading component matrix...') },
265
- React.createElement(
266
- Routes,
267
- null,
268
- dynamicRoutes.map((route) =>
269
- React.createElement(Route, {
270
- key: route.path,
271
- path: route.path,
272
- element: React.createElement(route.Component, { key: route.path })
273
- })
274
- )
258
+ Routes,
259
+ null,
260
+ dynamicRoutes.map((route) =>
261
+ React.createElement(Route, {
262
+ key: route.path,
263
+ path: route.path,
264
+ element: React.createElement(route.Component, { key: route.path })
265
+ })
275
266
  )
276
267
  )
277
268
  )