Skip to content

Commit 2603644

Browse files
committed
fix(ProxyManager): Support overriding proxy definition of activateOnCreate
1 parent 70aa5a3 commit 2603644

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

Sources/Proxy/Core/ProxyManager/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ export default function addRegistrationAPI(publicAPI, model) {
115115
return null;
116116
}
117117
const definition = definitions[group][name];
118+
const definitionOptions = Object.assign({}, definition.options, options);
118119
const proxy = definition.class.newInstance(
119-
Object.assign({}, definition.options, options, {
120+
Object.assign({}, definitionOptions, {
120121
proxyGroup: group,
121122
proxyName: name,
122123
proxyManager: publicAPI,
@@ -144,7 +145,7 @@ export default function addRegistrationAPI(publicAPI, model) {
144145

145146
registerProxy(proxy);
146147

147-
if ((definition.options || {}).activateOnCreate) {
148+
if (definitionOptions.activateOnCreate) {
148149
proxy.activate();
149150
}
150151

Sources/Testing/testProxy.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,17 @@ test('Proxy activation via config', (t) => {
7979
});
8080

8181
test('Proxy activation via .activate()', (t) => {
82-
const proxyManager = newProxyManager({
83-
definitions: {
84-
Sources: {
85-
TrivialProducer: {
86-
class: vtkTestProxyClass,
87-
options: {},
88-
},
89-
},
90-
},
91-
});
82+
const proxyManager = newProxyManager();
9283
t.equal(
9384
proxyManager.getActiveSource(),
9485
undefined,
9586
'No initial active source'
9687
);
9788

98-
const proxy = proxyManager.createProxy('Sources', 'TrivialProducer');
89+
const proxy = proxyManager.createProxy('Sources', 'TrivialProducer', {
90+
// Inhibit the default { activateOnCreate: true }
91+
activateOnCreate: false,
92+
});
9993
t.equal(
10094
proxyManager.getActiveSource(),
10195
undefined,

0 commit comments

Comments
 (0)