@nuvler/cli 0.5.14 → 0.5.15

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.
@@ -124,6 +124,20 @@ function PreviewApp() {
124
124
  const currentRequest = ++requestId.current;
125
125
  setRouteError(null);
126
126
  const localRoute = routeFromLocalData(url);
127
+ if (localRoute?.type === "editorial-list") {
128
+ setRoute({ type: "loading", pathname: url.pathname });
129
+ try {
130
+ const page = context.site.modules.includes("NAVIGATION")
131
+ ? await previewApi<{ title: string; description?: string; content: import("@nuvler/theme-sdk").ThemePageContent }>(`pages/${localRoute.basePath.slice(1)}`)
132
+ : null;
133
+ if (currentRequest === requestId.current) setRoute({ ...localRoute, ...(page ? { title: page.title, description: page.description ?? "", content: page.content } : {}) });
134
+ } catch (error) {
135
+ if (currentRequest !== requestId.current) return;
136
+ if (error instanceof PreviewHttpError && error.status === 404) setRoute(localRoute);
137
+ else setRouteError("Não foi possível carregar o conteúdo da listagem. Tente novamente.");
138
+ }
139
+ return;
140
+ }
127
141
  if (localRoute) { setRoute(localRoute); return; }
128
142
  setRoute({ type: "loading", pathname: url.pathname });
129
143
  try {