From 2680a6160a86cd4ed08a7c63dcb3b33c415cd35e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 10 Feb 2021 00:50:31 +0300 Subject: [PATCH] cleanup and minor fixes... Signed-off-by: Alex A. Naanou --- Viewer/features/core.js | 15 ++++++++++----- Viewer/features/filesystem.js | 11 ----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Viewer/features/core.js b/Viewer/features/core.js index ac46b59a..75778be4 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -3131,6 +3131,8 @@ var TaskActions = actions.Actions({ // Links... // + // NOTE: all links to current state in .links will be detached on .clear() + // // XXX after this is stabilized, do we need session tasks and its complexities??? __links: null, get links(){ @@ -3268,17 +3270,20 @@ module.Tasks = ImageGridFeatures.Feature({ handlers: [ // stop session tasks... ['clear', - // XXX BUG: for some reason calling .abort here does not work... - //'sessionTasks.stop'], 'sessionTasks.abort'], + // detach links to current state... ['clear.pre', function(){ + var that = this Object.values(this.links || []) .forEach(function(link){ - // NOTE: we do a partial detach here as .clear(..) will - // detach the data for us... - link.detachLink(false) }) }], + // only detach links to current state... + link.data === that.data + && link.images === that.images + // NOTE: we do a partial detach here as .clear(..) will + // detach the data for us... + && link.detachLink(false) }) }], ], }) diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index 62cbe813..ff7fda42 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -859,10 +859,6 @@ var FileSystemLoaderActions = actions.Actions({ // independently it would require a separate wrapper... // ...this seems quire a bit more convoluted than the current // .indexCheckerActions + .checkIndex(..) pair... - // XXX since this by default runs in a .linked context this will update - // the current context state if it was not reloaded but .changes if - // it was set to false will not reflect the changes made by the - // checker actions... checkIndex: ['File/Check index consistency', core.doc` @@ -892,14 +888,7 @@ var FileSystemLoaderActions = actions.Actions({ // XXX BUG?: this is not returned by the action for some reason... return res }) }], - // XXX add a context wrapper a-la .makeIndex(..)... - // ...might be a good idea to rename this to .checkIndexPaths(..) - // and make the .checkIndex(..) a context aggregate actions like - // .makeIndex(..) // XXX might be a good idea to also search for previews here... - // XXX technically this can be a non-session queue, but we'll - // need to save the check results... - // XXX update .handlers to maintain .changes via promise... checkIndexPaths: ['- File/', core.doc`Check index image path consistency