refactor - handle cloud listeners

This commit is contained in:
SPRINX0\prochazka
2025-05-26 17:02:09 +02:00
parent afde0a7423
commit d26db7096d
6 changed files with 83 additions and 19 deletions

View File

@@ -67,27 +67,27 @@
await apiCall('cloud/refresh-content');
}
async function loadCloudConnection(conid) {
const conn = await apiCall('connections/get', { conid });
$cloudConnectionsStore = {
...$cloudConnectionsStore,
[conid]: conn,
};
}
// async function loadCloudConnection(conid) {
// const conn = await apiCall('connections/get', { conid });
// $cloudConnectionsStore = {
// ...$cloudConnectionsStore,
// [conid]: conn,
// };
// }
function ensureCloudConnectionsLoaded(...conids) {
_.uniq(conids).forEach(conid => {
if (conid?.startsWith('cloud://') && !$cloudConnectionsStore[conid]) {
loadCloudConnection(conid);
}
});
}
// function ensureCloudConnectionsLoaded(...conids) {
// _.uniq(conids).forEach(conid => {
// if (conid?.startsWith('cloud://') && !$cloudConnectionsStore[conid]) {
// loadCloudConnection(conid);
// }
// });
// }
$: ensureCloudConnectionsLoaded(
$currentDatabase?.connection?._id,
...$openedSingleDatabaseConnections,
...$openedConnections
);
// $: ensureCloudConnectionsLoaded(
// $currentDatabase?.connection?._id,
// ...$openedSingleDatabaseConnections,
// ...$openedConnections
// );
// onMount(() => {
// const currentConid = $currentDatabase?.connection?._id;