Skip to content

Commit

Permalink
refactor: optimize data fetching in BlockDisplay & ChartDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
hngngn committed Jan 3, 2025
1 parent e3283b8 commit d6df4fd
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 544 deletions.
21 changes: 8 additions & 13 deletions docs/scripts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { existsSync, mkdirSync } from "node:fs";
import fs from "node:fs";
import fs, { existsSync, mkdirSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { registry } from "@/registry";
Expand Down Expand Up @@ -209,8 +208,7 @@ export const Index: Record<string, any> = {
})}],
component: clientOnly(() => import("${componentPath}"), { lazy: true }),
source: "${sourceFilename}",
category: "${item.category ?? ""}",
subcategory: "${item.subcategory ?? ""}"
category: "${item.category ?? ""}"
},`;
}
}
Expand All @@ -232,15 +230,12 @@ export const Index: Record<string, any> = {
return {
...item,
files: item.files?.map((_file) => {
const file =
typeof _file === "string"
? {
path: _file,
type: item.type,
}
: _file;

return file;
return typeof _file === "string"
? {
path: _file,
type: item.type,
}
: _file;
}),
};
});
Expand Down
Loading

0 comments on commit d6df4fd

Please sign in to comment.