fix find by id

This commit is contained in:
Rizky 2024-07-16 19:54:46 +07:00
parent 0ea9a29eac
commit 9a4f026196
2 changed files with 11 additions and 4 deletions

View File

@ -37,7 +37,7 @@ export const router = {
${[...imports].map((e) => `${e.replace(/\W/g, "_")}`).join(",\n ")}
}
`.trim();
content = `// AUTOGENERATED - DO NOT EDIT //\n\n${content}`;
content = `/** AUTOGENERATED - DO NOT EDIT **/\n\n${content}`;
const hash = simpleHash(content);
const router = Bun.file(

View File

@ -12,7 +12,7 @@ export const EdTreeSearch = () => {
focus: false,
hover: false,
cursor: null as number | null,
search_timeout: null as any
search_timeout: null as any,
});
p.ui.tree.search_ref = local.sref;
@ -122,13 +122,20 @@ export const doTreeSearch = (p: PG) => {
ptree = p.comp.list[active.comp_id].tree;
}
const comp_searched = new Set<string>()
const comp_searched = new Set<string>();
const searchInPTree = (ptree: NodeModel<IMeta>[], id_component?: string) => {
if (p.ui.tree.search_mode.Name) {
const found = fuzzy(ptree, "text", search);
const id_found = ptree.find((e) => e.id === search);
let i = 0;
if (id_found) {
tree[id_found.id] = { idx: 0, node: { ...id_found, parent: "root" } };
i = 1;
}
for (const row of found) {
if (row.data) {
if (id_component && row.data.parent)
@ -183,7 +190,7 @@ export const doTreeSearch = (p: PG) => {
}
}
}
}
};
searchInPTree(ptree);