Skip to content

Commit 81ef7c5

Browse files
committed
fix: fixing the protection level not display properly
1 parent f8163e6 commit 81ef7c5

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/renderer/components/Toolbar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Toolbar.ContextMenu = function ToolbarContextMenu({
137137
<span>{text}</span>
138138
</li>
139139
);
140-
}, []);
140+
}, [text]);
141141

142142
return <AttachedContextMenu items={items} activator={activator} />;
143143
};

src/renderer/contexts/DatabaseSettingProvider.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
useContext,
88
useState,
99
} from 'react';
10-
import { db } from 'renderer/db';
1110

1211
const DatabaseSettingContext = createContext<{
1312
setting?: ConnectionStoreItem;
@@ -27,15 +26,14 @@ export function DatabaseSettingProvider({
2726
setting,
2827
}: PropsWithChildren<{ setting: ConnectionStoreItem }>) {
2928
const [protectionLevel, setProductionLevel] = useState(
30-
setting.protectionLevel === undefined ? 1 : setting.protectionLevel
29+
setting.protectionLevel === undefined ? 1 : setting.protectionLevel,
3130
);
3231

3332
const setProductionLevelCallback = useCallback(
3433
(level: number) => {
3534
setProductionLevel(level);
36-
db.table('database_config').put({ ...setting, protectionLevel: level });
3735
},
38-
[setProductionLevel]
36+
[setProductionLevel],
3937
);
4038

4139
return (

0 commit comments

Comments
 (0)