@cocojs/mvc 0.1.0-beta.10 → 0.1.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -6354,12 +6354,19 @@ function getAutowiredStores(ctor, instance) {
6354
6354
  });
6355
6355
  return uniqueStores;
6356
6356
  }
6357
- function createFiber() {
6357
+ function createFiber(storeInstance) {
6358
+ const ctor = storeInstance.constructor;
6359
+ const { application } = getCommonApi();
6360
+ const Autowired = application.getMetaClassById('Autowired');
6361
+ const autowiredFields = application.listFieldByMetadataCls(ctor, Autowired);
6358
6362
  return {
6359
6363
  alternate: null,
6360
6364
  stateNode: null,
6361
6365
  updateQueue: null,
6362
- memoizedState: null,
6366
+ memoizedState: autowiredFields.reduce((prev, field) => {
6367
+ prev[field] = storeInstance[field];
6368
+ return prev;
6369
+ }, {}),
6363
6370
  };
6364
6371
  }
6365
6372
  /**
@@ -6386,7 +6393,7 @@ function initFiber(storeInstance) {
6386
6393
  if (storeInstance[fiberField]) {
6387
6394
  return;
6388
6395
  }
6389
- storeInstance[fiberField] = createFiber();
6396
+ storeInstance[fiberField] = createFiber(storeInstance);
6390
6397
  storeInstance[updaterField] = storeComponentUpdater;
6391
6398
  initializeUpdateQueue(storeInstance[fiberField]);
6392
6399
  }
package/dist/index.esm.js CHANGED
@@ -6352,12 +6352,19 @@ function getAutowiredStores(ctor, instance) {
6352
6352
  });
6353
6353
  return uniqueStores;
6354
6354
  }
6355
- function createFiber() {
6355
+ function createFiber(storeInstance) {
6356
+ const ctor = storeInstance.constructor;
6357
+ const { application } = getCommonApi();
6358
+ const Autowired = application.getMetaClassById('Autowired');
6359
+ const autowiredFields = application.listFieldByMetadataCls(ctor, Autowired);
6356
6360
  return {
6357
6361
  alternate: null,
6358
6362
  stateNode: null,
6359
6363
  updateQueue: null,
6360
- memoizedState: null,
6364
+ memoizedState: autowiredFields.reduce((prev, field) => {
6365
+ prev[field] = storeInstance[field];
6366
+ return prev;
6367
+ }, {}),
6361
6368
  };
6362
6369
  }
6363
6370
  /**
@@ -6384,7 +6391,7 @@ function initFiber(storeInstance) {
6384
6391
  if (storeInstance[fiberField]) {
6385
6392
  return;
6386
6393
  }
6387
- storeInstance[fiberField] = createFiber();
6394
+ storeInstance[fiberField] = createFiber(storeInstance);
6388
6395
  storeInstance[updaterField] = storeComponentUpdater;
6389
6396
  initializeUpdateQueue(storeInstance[fiberField]);
6390
6397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocojs/mvc",
3
- "version": "0.1.0-beta.10",
3
+ "version": "0.1.0-beta.11",
4
4
  "description": "由装饰器驱动,快速构建可扩展的 Web 应用。",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",