Re-rendering the thumbnail when external data is changed

This commit is contained in:
Bruno Alves de Faria committed 2017-03-30 10:56:57 -03:00
1 parent 41fb606b2a
commit 66dfefbb14
3 files changed
+34 -31

No files matched your search

@@ -1,11 +1,7 @@
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
// OHIF Modules
import { OHIF } from 'meteor/ohif:core';
// Local Modules
import { getImageId } from '../../../lib/getImageId.js';
import { getWADORSImageId } from '../../../lib/getWADORSImageId.js';
Template.imageThumbnail.onCreated(() => {
const instance = Template.instance();
@@ -17,7 +13,7 @@ Template.imageThumbnail.onCreated(() => {
let imageIndex = Math.floor(lastIndex / 2);
let imageInstance;
if(stack.isMultiFrame) {
if (stack.isMultiFrame) {
imageInstance = stack.images[0];
} else {
imageInstance = stack.images[imageIndex];
@@ -79,6 +75,9 @@ Template.imageThumbnail.onRendered(() => {
instance.data.currentStudy.dep.depend();
}
// Depend on external data and re-run this computation when it changes
Template.currentData();
// Wait for the new data and refresh the image thumbnail
Tracker.afterFlush(() => instance.refreshImage());
});