File tree Expand file tree Collapse file tree 1 file changed +51
-46
lines changed
packages/reactant-module/src/core Expand file tree Collapse file tree 1 file changed +51
-46
lines changed Original file line number Diff line number Diff line change @@ -258,55 +258,60 @@ export function createStore<T = any>({
258258 } ) ;
259259 }
260260 subscriptions . push ( service [ subscriptionsKey ] ! ) ;
261- Object . defineProperties ( service , {
262- [ modulesKey ] : {
263- enumerable : false ,
264- configurable : false ,
265- writable : false ,
266- value : modulesMap ,
267- } ,
268- [ identifierKey ] : {
269- enumerable : false ,
270- configurable : false ,
271- writable : false ,
272- value : identifier ,
273- } ,
274- // in order to support multiple instances for stores.
275- [ storeKey ] : {
276- enumerable : false ,
277- configurable : false ,
278- get ( ) {
279- return store ;
261+ try {
262+ Object . defineProperties ( service , {
263+ [ modulesKey ] : {
264+ enumerable : false ,
265+ configurable : false ,
266+ writable : false ,
267+ value : modulesMap ,
280268 } ,
281- } ,
282- [ containerKey ] : {
283- enumerable : false ,
284- configurable : false ,
285- get ( ) {
286- return container ;
269+ [ identifierKey ] : {
270+ enumerable : false ,
271+ configurable : false ,
272+ writable : false ,
273+ value : identifier ,
287274 } ,
288- } ,
289- // loader for dynamic modules.
290- [ loaderKey ] : {
291- enumerable : false ,
292- configurable : false ,
293- value ( ... args : Parameters < Loader > ) {
294- load ( ... args ) ;
275+ // in order to support multiple instances for stores.
276+ [ storeKey ] : {
277+ enumerable : false ,
278+ configurable : false ,
279+ get ( ) {
280+ return store ;
281+ } ,
295282 } ,
296- } ,
297- // enablePatches options for immer
298- [ enablePatchesKey ] : {
299- enumerable : false ,
300- configurable : false ,
301- value : enablePatches ,
302- } ,
303- // enableInspector options for state changing check before dispatching
304- [ enableInspectorKey ] : {
305- enumerable : false ,
306- configurable : false ,
307- value : enableInspector ,
308- } ,
309- } ) ;
283+ [ containerKey ] : {
284+ enumerable : false ,
285+ configurable : false ,
286+ get ( ) {
287+ return container ;
288+ } ,
289+ } ,
290+ // loader for dynamic modules.
291+ [ loaderKey ] : {
292+ enumerable : false ,
293+ configurable : false ,
294+ value ( ...args : Parameters < Loader > ) {
295+ load ( ...args ) ;
296+ } ,
297+ } ,
298+ // enablePatches options for immer
299+ [ enablePatchesKey ] : {
300+ enumerable : false ,
301+ configurable : false ,
302+ value : enablePatches ,
303+ } ,
304+ // enableInspector options for state changing check before dispatching
305+ [ enableInspectorKey ] : {
306+ enumerable : false ,
307+ configurable : false ,
308+ value : enableInspector ,
309+ } ,
310+ } ) ;
311+ } catch ( e ) {
312+ console . error ( `${ service } has unexpected errors.` ) ;
313+ throw e ;
314+ }
310315 } ) ;
311316 }
312317 }
You can’t perform that action at this time.
0 commit comments