@abi-software/flatmapvuer 0.4.1-beta.4 → 0.4.2

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/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.4.1-beta.3",
3
+ "version": "0.4.1",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.4.1-beta.4",
3
+ "version": "0.4.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/flatmapvuer.common.js",
6
6
  "files": [
@@ -332,6 +332,10 @@ export default {
332
332
  beforeCreate: function() {
333
333
  this.mapManager = undefined;
334
334
  this.mapImp = undefined;
335
+ //The state watcher may triggered before
336
+ //created causing issue, This flag will
337
+ //resolve this issue.
338
+ this.setStateRequired = false;
335
339
  },
336
340
  methods: {
337
341
  viewLatestMap: function() {
@@ -651,6 +655,7 @@ export default {
651
655
  } else {
652
656
  this.createFlatmap(state);
653
657
  }
658
+ this.setStateRequired = false;
654
659
  }
655
660
  },
656
661
  restoreMapState: function(state) {
@@ -969,7 +974,12 @@ export default {
969
974
  },
970
975
  state: {
971
976
  handler: function(state) {
972
- this.setState(state);
977
+ if (this.mapManager) {
978
+ this.setState(state);
979
+ } else {
980
+ //this component has not been mounted yet
981
+ this.setStateRequired = true;
982
+ }
973
983
  },
974
984
  immediate: true,
975
985
  deep: true
@@ -988,9 +998,16 @@ export default {
988
998
  mounted: function() {
989
999
  const flatmap = require("@abi-software/flatmap-viewer");
990
1000
  this.mapManager = new flatmap.MapManager(this.flatmapAPI);
991
- if (this.renderAtMounted) this.createFlatmap();
992
1001
  this.flatmapQueries = new FlatmapQueries();
993
1002
  this.flatmapQueries.initialise(this.sparcAPI, this.flatmapAPI);
1003
+ if (this.state) {
1004
+ //State is set and require to set the state
1005
+ if (this.setStateRequired) {
1006
+ this.setState(this.state);
1007
+ }
1008
+ } else if(this.renderAtMounted) {
1009
+ this.createFlatmap();
1010
+ }
994
1011
  }
995
1012
  };
996
1013
  </script>