diff --git a/comps/form/gen/gen-form.ts b/comps/form/gen/gen-form.ts index 08b2541..82150aa 100755 --- a/comps/form/gen/gen-form.ts +++ b/comps/form/gen/gen-form.ts @@ -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", diff --git a/comps/md/gen/md-gen.ts b/comps/md/gen/md-gen.ts index fecfbf5..6446bc3 100755 --- a/comps/md/gen/md-gen.ts +++ b/comps/md/gen/md-gen.ts @@ -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) {} diff --git a/gen/prop/gen_prop_fields.ts b/gen/prop/gen_prop_fields.ts index 51584ba..5fa83b2 100755 --- a/gen/prop/gen_prop_fields.ts +++ b/gen/prop/gen_prop_fields.ts @@ -118,6 +118,8 @@ const get_layer = async ( return options; }; +const pending = {} as Record[]>; + 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])); }