This commit is contained in:
rizky 2024-07-25 02:30:58 -07:00
parent 5e8b25d174
commit 9e35d38f13
3 changed files with 13 additions and 4 deletions

View File

@ -94,7 +94,7 @@ export const generateForm = async (
};
const existing_childs = (
(item.component?.props.body as any)?.content as IItem
).childs;
)?.childs;
let child_body = createItem({
name: "item",

View File

@ -17,7 +17,6 @@ export const generateMasterDetail: GenFn<{
if (!title && item.edit.props?.gen_table) {
const table = { ...item.edit.props?.gen_table };
table.value = `${formatName(table.value as string)}`;
console.log(table.value);
item.edit.setProp("title", table.value);
}
} catch (e) {}

View File

@ -118,6 +118,8 @@ const get_layer = async (
return options;
};
const pending = {} as Record<string, Promise<any>[]>;
const loadSingle = async (id_site: string, table: string) => {
const ls_key = `schema-md-${id_site}`;
const idb_key = `${id_site}-${table}`;
@ -143,10 +145,18 @@ const loadSingle = async (id_site: string, table: string) => {
if (cached) {
single[table] = cached;
} else {
if (!pending[table]) {
pending[table] = [
db._schema.columns(table as any),
db._schema.rels(table as any),
];
}
await Promise.all(pending[table]);
single[table] = {
cols: await db._schema.columns(table as any),
rels: await db._schema.rels(table as any),
cols: await pending[table][0] as any,
rels: await pending[table][1] as any,
};
await kset(idb_key, single[table]);
localStorage.setItem(ls_key, JSON.stringify([...cached_keys, table]));
}