mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fixed save generated content in useEditorData
This commit is contained in:
parent
d3039a9248
commit
dcfefc78a2
@ -43,6 +43,8 @@ export default function useEditorData({ tabid, reloadToken = 0, loadFromArgs = n
|
||||
setValue(init);
|
||||
valueRef.current = init;
|
||||
initialDataRef.current = init;
|
||||
// mark as not saved
|
||||
changeCounterRef.current += 1;
|
||||
} catch (err) {
|
||||
const message = (err && err.response && err.response.data && err.response.data.error) || 'Loading failed';
|
||||
setErrorMessage(message);
|
||||
|
@ -15,6 +15,8 @@ export default function useStorage(key, storageObject, initialValue) {
|
||||
return initialValue;
|
||||
}
|
||||
});
|
||||
|
||||
// use storedValue to ref, so that setValue with function argument works without changeing setValue itself
|
||||
const storedValueRef = React.useRef(storedValue);
|
||||
storedValueRef.current = storedValue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user