schema selector is cached by conid and database

This commit is contained in:
SPRINX0\prochazka
2024-09-18 14:07:33 +02:00
parent 1f7b632553
commit 327d43096f
2 changed files with 6 additions and 0 deletions

View File

@@ -11,6 +11,8 @@
export let objectList; export let objectList;
export let onApplySelectedSchema; export let onApplySelectedSchema;
export let valueStorageKey;
let appliedSchema; let appliedSchema;
$: { $: {
@@ -46,6 +48,8 @@
function handleAddNewSchema() { function handleAddNewSchema() {
// runCommand('add-schema', { conid: dbinfo.conid, database: dbinfo.database }); // runCommand('add-schema', { conid: dbinfo.conid, database: dbinfo.database });
} }
$: selectedSchema = localStorage.getItem(valueStorageKey ?? '');
</script> </script>
{#if schemaList.length > 0} {#if schemaList.length > 0}
@@ -62,6 +66,7 @@
value={selectedSchema ?? appliedSchema ?? ''} value={selectedSchema ?? appliedSchema ?? ''}
on:change={e => { on:change={e => {
selectedSchema = e.detail; selectedSchema = e.detail;
localStorage.setItem(valueStorageKey, e.detail);
}} }}
selectClass="schema-select" selectClass="schema-select"
/> />

View File

@@ -150,6 +150,7 @@
onApplySelectedSchema={x => { onApplySelectedSchema={x => {
appliedSelectedSchema = x; appliedSelectedSchema = x;
}} }}
valueStorageKey={`sql-object-list-schema-${conid}-${database}`}
/> />
<WidgetsInnerContainer> <WidgetsInnerContainer>