diff --git a/packages/web/src/utility/useStorage.js b/packages/web/src/utility/useStorage.js
index c81e2dbe..5f0e145d 100644
--- a/packages/web/src/utility/useStorage.js
+++ b/packages/web/src/utility/useStorage.js
@@ -11,14 +11,14 @@ export default function useStorage(key, storageObject, initialValue) {
return item ? JSON.parse(item) : initialValue;
} catch (error) {
// If error also return initialValue
- console.log(error);
+ console.error(error);
return initialValue;
}
});
// Return a wrapped version of useState's setter function that ...
// ... persists the new value to localStorage.
- const setValue = value => {
+ const setValue = (value) => {
try {
// Allow value to be a function so we have same API as useState
const valueToStore = value instanceof Function ? value(storedValue) : value;
@@ -28,7 +28,8 @@ export default function useStorage(key, storageObject, initialValue) {
storageObject.setItem(key, JSON.stringify(valueToStore));
} catch (error) {
// A more advanced implementation would handle the error case
- console.log(error);
+ console.error(error);
+ console.log('Error saving storage value', key, value);
}
};
diff --git a/packages/web/src/widgets/TabControl.js b/packages/web/src/widgets/TabControl.js
index edfb30a7..2334776e 100644
--- a/packages/web/src/widgets/TabControl.js
+++ b/packages/web/src/widgets/TabControl.js
@@ -80,6 +80,12 @@ export function TabControl({ children, activePageIndex = undefined, activePageLa
}
}, [activePageLabel]);
+ React.useEffect(() => {
+ if (childrenArray.length > 0 && (value < 0 || value >= childrenArray.length)) {
+ setValue(0);
+ }
+ });
+
const theme = useTheme();
// // cleanup closed tabs
diff --git a/packages/web/src/widgets/Toolbar.js b/packages/web/src/widgets/Toolbar.js
index 57a9865e..1baa227a 100644
--- a/packages/web/src/widgets/Toolbar.js
+++ b/packages/web/src/widgets/Toolbar.js
@@ -142,11 +142,11 @@ export default function ToolBar({ toolbarPortalRef }) {
))}
{config.runAsPortal == false && Connection}
- SQL query
- {!!currentDatabase && Query designer}
- Free table editor
- Markdown page
- JavaScript shell script
+ newQuery()}>SQL query
+ {!!currentDatabase && newQueryDesign()}>Query designer}
+ newFreeTable()}>Free table editor
+ newMarkdown()}>Markdown page
+ newShell()}>JavaScript shell script