Skip to content

Commit 949811c

Browse files
authored
Suboptimal workaround for forking when applying updates. (#1785)
1 parent 3b93adb commit 949811c

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/visualizers/panels/Sidebar/SidebarPanel.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
define([
55
'deepforge/updates/Updates',
6+
'deepforge/utils',
67
'js/Constants',
78
'js/PanelBase/PanelBase',
89
'panels/AutoViz/AutoVizPanel',
@@ -11,6 +12,7 @@ define([
1112
'q'
1213
], function (
1314
Updates,
15+
Utils,
1416
CONSTANTS,
1517
PanelBase,
1618
AutoVizPanel,
@@ -164,15 +166,14 @@ define([
164166
});
165167
};
166168

167-
SidebarPanel.prototype.applyUpdates = function (updates) {
168-
// Seed Updates should apply the
169+
SidebarPanel.prototype.applyUpdates = async function (updates) {
169170
const seedUpdates = updates.filter(update => update.type === Updates.SEED);
170-
const promises = seedUpdates.map(update => {
171-
const {name, hash} = update;
172-
return Q.ninvoke(this._client, 'updateLibrary', name, hash);
173-
});
171+
for (let i = 0; i < seedUpdates.length; i++) {
172+
const {name, hash} = seedUpdates[i];
173+
await Q.ninvoke(this._client, 'updateLibrary', name, hash);
174+
}
174175

175-
// Apply the migrations
176+
await Utils.sleep(1000);
176177
const pluginId = 'ApplyUpdates';
177178
const migrations = updates
178179
.filter(update => update.type === Updates.MIGRATION)
@@ -183,11 +184,7 @@ define([
183184
updates: migrations
184185
};
185186

186-
promises.push(
187-
Q.ninvoke(this._client, 'runServerPlugin', pluginId, context)
188-
);
189-
190-
return Q.all(promises);
187+
await Q.ninvoke(this._client, 'runServerPlugin', pluginId, context);
191188
};
192189

193190
return SidebarPanel;

0 commit comments

Comments
 (0)