@micromag/core 0.3.332 → 0.3.343

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/es/contexts.js CHANGED
@@ -984,32 +984,36 @@ var useUrlGenerator = function useUrlGenerator() {
984
984
  };
985
985
  var useRoutePush = function useRoutePush() {
986
986
  var url = useUrlGenerator();
987
- var history = useHistory();
987
+ var history = useHistory() || null;
988
988
  var push = useCallback(function (route, data) {
989
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
990
- args[_key - 2] = arguments[_key];
991
- }
992
- if (isString(route)) {
993
- history.push.apply(history, [url(route, data)].concat(args));
994
- } else {
995
- var _ref = route || {},
996
- _ref$pathname = _ref.pathname,
997
- pathname = _ref$pathname === void 0 ? null : _ref$pathname,
998
- _ref$search = _ref.search,
999
- search = _ref$search === void 0 ? null : _ref$search;
1000
- history.push.apply(history, [{
1001
- pathname: url(pathname, data),
1002
- search: search
1003
- }].concat(args));
989
+ if (history !== null && history.push) {
990
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
991
+ args[_key - 2] = arguments[_key];
992
+ }
993
+ if (isString(route)) {
994
+ history.push.apply(history, [url(route, data)].concat(args));
995
+ } else {
996
+ var _ref = route || {},
997
+ _ref$pathname = _ref.pathname,
998
+ pathname = _ref$pathname === void 0 ? null : _ref$pathname,
999
+ _ref$search = _ref.search,
1000
+ search = _ref$search === void 0 ? null : _ref$search;
1001
+ history.push.apply(history, [{
1002
+ pathname: url(pathname, data),
1003
+ search: search
1004
+ }].concat(args));
1005
+ }
1004
1006
  }
1005
1007
  }, [history, url]);
1006
1008
  return push;
1007
1009
  };
1008
1010
  var useRouteBack = function useRouteBack() {
1009
1011
  var url = useUrlGenerator();
1010
- var history = useHistory();
1012
+ var history = useHistory() || null;
1011
1013
  var back = useCallback(function () {
1012
- return history.goBack();
1014
+ if (history !== null && history.goBack) {
1015
+ history.goBack();
1016
+ }
1013
1017
  }, [history, url]);
1014
1018
  return back;
1015
1019
  };
package/lib/contexts.js CHANGED
@@ -1019,32 +1019,36 @@ var useUrlGenerator = function useUrlGenerator() {
1019
1019
  };
1020
1020
  var useRoutePush = function useRoutePush() {
1021
1021
  var url = useUrlGenerator();
1022
- var history = reactRouter.useHistory();
1022
+ var history = reactRouter.useHistory() || null;
1023
1023
  var push = React.useCallback(function (route, data) {
1024
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1025
- args[_key - 2] = arguments[_key];
1026
- }
1027
- if (isString__default["default"](route)) {
1028
- history.push.apply(history, [url(route, data)].concat(args));
1029
- } else {
1030
- var _ref = route || {},
1031
- _ref$pathname = _ref.pathname,
1032
- pathname = _ref$pathname === void 0 ? null : _ref$pathname,
1033
- _ref$search = _ref.search,
1034
- search = _ref$search === void 0 ? null : _ref$search;
1035
- history.push.apply(history, [{
1036
- pathname: url(pathname, data),
1037
- search: search
1038
- }].concat(args));
1024
+ if (history !== null && history.push) {
1025
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1026
+ args[_key - 2] = arguments[_key];
1027
+ }
1028
+ if (isString__default["default"](route)) {
1029
+ history.push.apply(history, [url(route, data)].concat(args));
1030
+ } else {
1031
+ var _ref = route || {},
1032
+ _ref$pathname = _ref.pathname,
1033
+ pathname = _ref$pathname === void 0 ? null : _ref$pathname,
1034
+ _ref$search = _ref.search,
1035
+ search = _ref$search === void 0 ? null : _ref$search;
1036
+ history.push.apply(history, [{
1037
+ pathname: url(pathname, data),
1038
+ search: search
1039
+ }].concat(args));
1040
+ }
1039
1041
  }
1040
1042
  }, [history, url]);
1041
1043
  return push;
1042
1044
  };
1043
1045
  var useRouteBack = function useRouteBack() {
1044
1046
  var url = useUrlGenerator();
1045
- var history = reactRouter.useHistory();
1047
+ var history = reactRouter.useHistory() || null;
1046
1048
  var back = React.useCallback(function () {
1047
- return history.goBack();
1049
+ if (history !== null && history.goBack) {
1050
+ history.goBack();
1051
+ }
1048
1052
  }, [history, url]);
1049
1053
  return back;
1050
1054
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.332",
3
+ "version": "0.3.343",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "61fe137d589629d05127be69b667fc62f8ca1d18"
136
+ "gitHead": "ad3917e5493d6fe07ea9cb2d35a1f0a560009b6c"
137
137
  }