@djangocfg/ui-tools 2.1.360 → 2.1.361

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.
@@ -164,6 +164,17 @@ function useOpenApiSchema({
164
164
  }
165
165
  setLoading(true);
166
166
  setError(null);
167
+ if (currentSchema.data) {
168
+ setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, currentSchema.data));
169
+ consola__default.default.success(`Schema loaded (static): ${currentSchema.name}`);
170
+ setLoading(false);
171
+ return;
172
+ }
173
+ if (!currentSchema.url) {
174
+ setError("SchemaSource requires either url or data");
175
+ setLoading(false);
176
+ return;
177
+ }
167
178
  fetchSchema(currentSchema.url).then((schema) => {
168
179
  setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, schema));
169
180
  consola__default.default.success(`Schema loaded: ${currentSchema.name}`);
@@ -194,7 +205,7 @@ function useOpenApiSchema({
194
205
  });
195
206
  Promise.allSettled(
196
207
  pending.map(
197
- (s) => fetchSchema(s.url).then((schema) => ({ id: s.id, name: s.name, schema }))
208
+ (s) => s.data ? Promise.resolve({ id: s.id, name: s.name, schema: s.data }) : s.url ? fetchSchema(s.url).then((schema) => ({ id: s.id, name: s.name, schema })) : Promise.reject(new Error("SchemaSource requires either url or data"))
198
209
  )
199
210
  ).then((results) => {
200
211
  if (cancelled) return;
@@ -262,6 +273,11 @@ function useOpenApiSchema({
262
273
  }, []);
263
274
  const refresh = React12.useCallback(() => {
264
275
  if (!currentSchema) return;
276
+ if (currentSchema.data) {
277
+ setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, currentSchema.data));
278
+ return;
279
+ }
280
+ if (!currentSchema.url) return;
265
281
  setLoading(true);
266
282
  setError(null);
267
283
  setLoadedSchemas((prev) => {
@@ -3435,5 +3451,5 @@ var DocsLayout = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
3435
3451
  }, "DocsLayout");
3436
3452
 
3437
3453
  exports.DocsLayout = DocsLayout;
3438
- //# sourceMappingURL=DocsLayout-OQHDNKZE.cjs.map
3439
- //# sourceMappingURL=DocsLayout-OQHDNKZE.cjs.map
3454
+ //# sourceMappingURL=DocsLayout-QOSSLH22.cjs.map
3455
+ //# sourceMappingURL=DocsLayout-QOSSLH22.cjs.map