Skip to content

Modern Docker Management, Designed for Everyone

fix: use mount-time environment and volume in workspace cache listener (#4563)

Kyle Mendellbaaaef508759
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index fd1d77c02..912449d91 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -390,27 +390,25 @@
onMount(() => {
const cache = queryClient.getQueryCache();
+ const environmentId = currentEnvId;
+ const volumeName = volume?.name;
const loadAfterUpdate = async () => {
- const environmentId = currentEnvId;
- const volumeName = volume?.name;
await tick();
- if (!active || !volumeName || environmentId !== currentEnvId || volumeName !== volume?.name) return;
+ if (!active || !volumeName) return;
initializeVolumePreferences();
loadSelectedWorkspaceFile();
};
const unsubscribe = cache.subscribe((event) => {
- if (!active || (event.type !== 'updated' && event.type !== 'observerResultsUpdated')) return;
- const volumeName = volume?.name;
- if (!volumeName) return;
+ if (!active || !volumeName || (event.type !== 'updated' && event.type !== 'observerResultsUpdated')) return;
const backupPath = cache.find({
- queryKey: queryKeys.volumes.backupHasPath(currentEnvId, volumeName, selectedWorkspaceBackupId, workspaceRestorePath),
+ queryKey: queryKeys.volumes.backupHasPath(environmentId, volumeName, selectedWorkspaceBackupId, workspaceRestorePath),
exact: true
});
if (event.query === backupPath) {
notifyWorkspaceBackupError(event.query.state.error);
}
if (event.type !== 'updated' || event.action.type !== 'success') return;
- if (event.query === cache.find({ queryKey: queryKeys.volumes.workspace(currentEnvId, volumeName), exact: true })) {
+ if (event.query === cache.find({ queryKey: queryKeys.volumes.workspace(environmentId, volumeName), exact: true })) {
void loadAfterUpdate();
}
});