mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 21:16:00 +00:00
Merge branch 'master' into develop
This commit is contained in:
@@ -56,8 +56,8 @@ export default {
|
||||
y: 89,
|
||||
z: 90,
|
||||
leftWindowKey: 91,
|
||||
rightWindowKey: 92,
|
||||
selectKey: 93,
|
||||
rightWindowKey: 93,
|
||||
// selectKey: 93,
|
||||
numPad0: 96,
|
||||
numPad1: 97,
|
||||
numPad2: 98,
|
||||
|
||||
@@ -189,25 +189,29 @@ async function getCore(loader, args) {
|
||||
function useCore(loader, args) {
|
||||
const { url, params, reloadTrigger, transform, onLoaded } = loader(args);
|
||||
const cacheKey = stableStringify({ url, ...params });
|
||||
let closed = false;
|
||||
let openedCount = 0;
|
||||
|
||||
return {
|
||||
subscribe: onChange => {
|
||||
async function handleReload() {
|
||||
const res = await getCore(loader, args);
|
||||
if (!closed) {
|
||||
if (openedCount > 0) {
|
||||
onChange(res);
|
||||
}
|
||||
}
|
||||
|
||||
openedCount += 1;
|
||||
handleReload();
|
||||
|
||||
if (reloadTrigger) {
|
||||
subscribeCacheChange(reloadTrigger, cacheKey, handleReload);
|
||||
return () => {
|
||||
closed = true;
|
||||
openedCount -= 1;
|
||||
unsubscribeCacheChange(reloadTrigger, cacheKey, handleReload);
|
||||
};
|
||||
} else {
|
||||
return () => {
|
||||
openedCount -= 1;
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user