@opengeoweb/warnings 8.3.0 → 8.3.1

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.
Files changed (2) hide show
  1. package/index.esm.js +154 -128
  2. package/package.json +12 -12
package/index.esm.js CHANGED
@@ -486,12 +486,12 @@ function getContext() {
486
486
 
487
487
  const ReactReduxContext = /*#__PURE__*/getContext();
488
488
 
489
- /**
490
- * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
491
- * hook that you should usually not need to call directly.
492
- *
493
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
494
- * @returns {Function} A `useReduxContext` hook bound to the specified context.
489
+ /**
490
+ * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
491
+ * hook that you should usually not need to call directly.
492
+ *
493
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
494
+ * @returns {Function} A `useReduxContext` hook bound to the specified context.
495
495
  */
496
496
  function createReduxContextHook(context = ReactReduxContext) {
497
497
  return function useReduxContext() {
@@ -504,21 +504,21 @@ function createReduxContextHook(context = ReactReduxContext) {
504
504
  return contextValue;
505
505
  };
506
506
  }
507
- /**
508
- * A hook to access the value of the `ReactReduxContext`. This is a low-level
509
- * hook that you should usually not need to call directly.
510
- *
511
- * @returns {any} the value of the `ReactReduxContext`
512
- *
513
- * @example
514
- *
515
- * import React from 'react'
516
- * import { useReduxContext } from 'react-redux'
517
- *
518
- * export const CounterComponent = () => {
519
- * const { store } = useReduxContext()
520
- * return <div>{store.getState()}</div>
521
- * }
507
+ /**
508
+ * A hook to access the value of the `ReactReduxContext`. This is a low-level
509
+ * hook that you should usually not need to call directly.
510
+ *
511
+ * @returns {any} the value of the `ReactReduxContext`
512
+ *
513
+ * @example
514
+ *
515
+ * import React from 'react'
516
+ * import { useReduxContext } from 'react-redux'
517
+ *
518
+ * export const CounterComponent = () => {
519
+ * const { store } = useReduxContext()
520
+ * return <div>{store.getState()}</div>
521
+ * }
522
522
  */
523
523
 
524
524
  const useReduxContext = /*#__PURE__*/createReduxContextHook();
@@ -533,11 +533,11 @@ const initializeUseSelector = fn => {
533
533
  };
534
534
 
535
535
  const refEquality = (a, b) => a === b;
536
- /**
537
- * Hook factory, which creates a `useSelector` hook bound to a given context.
538
- *
539
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
540
- * @returns {Function} A `useSelector` hook bound to the specified context.
536
+ /**
537
+ * Hook factory, which creates a `useSelector` hook bound to a given context.
538
+ *
539
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
540
+ * @returns {Function} A `useSelector` hook bound to the specified context.
541
541
  */
542
542
 
543
543
 
@@ -585,10 +585,21 @@ function createSelectorHook(context = ReactReduxContext) {
585
585
  const toCompare = selector(state);
586
586
 
587
587
  if (!equalityFn(selected, toCompare)) {
588
+ let stack = undefined;
589
+
590
+ try {
591
+ throw new Error();
592
+ } catch (e) {
593
+ ({
594
+ stack
595
+ } = e);
596
+ }
597
+
588
598
  console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {
589
599
  state,
590
600
  selected,
591
- selected2: toCompare
601
+ selected2: toCompare,
602
+ stack
592
603
  });
593
604
  }
594
605
  }
@@ -598,7 +609,19 @@ function createSelectorHook(context = ReactReduxContext) {
598
609
  if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {
599
610
  // @ts-ignore
600
611
  if (selected === state) {
601
- console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.');
612
+ let stack = undefined;
613
+
614
+ try {
615
+ throw new Error();
616
+ } catch (e) {
617
+ ({
618
+ stack
619
+ } = e);
620
+ }
621
+
622
+ console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.', {
623
+ stack
624
+ });
602
625
  }
603
626
  }
604
627
 
@@ -614,28 +637,28 @@ function createSelectorHook(context = ReactReduxContext) {
614
637
  return selectedState;
615
638
  };
616
639
  }
617
- /**
618
- * A hook to access the redux store's state. This hook takes a selector function
619
- * as an argument. The selector is called with the store state.
620
- *
621
- * This hook takes an optional equality comparison function as the second parameter
622
- * that allows you to customize the way the selected state is compared to determine
623
- * whether the component needs to be re-rendered.
624
- *
625
- * @param {Function} selector the selector function
626
- * @param {Function=} equalityFn the function that will be used to determine equality
627
- *
628
- * @returns {any} the selected state
629
- *
630
- * @example
631
- *
632
- * import React from 'react'
633
- * import { useSelector } from 'react-redux'
634
- *
635
- * export const CounterComponent = () => {
636
- * const counter = useSelector(state => state.counter)
637
- * return <div>{counter}</div>
638
- * }
640
+ /**
641
+ * A hook to access the redux store's state. This hook takes a selector function
642
+ * as an argument. The selector is called with the store state.
643
+ *
644
+ * This hook takes an optional equality comparison function as the second parameter
645
+ * that allows you to customize the way the selected state is compared to determine
646
+ * whether the component needs to be re-rendered.
647
+ *
648
+ * @param {Function} selector the selector function
649
+ * @param {Function=} equalityFn the function that will be used to determine equality
650
+ *
651
+ * @returns {any} the selected state
652
+ *
653
+ * @example
654
+ *
655
+ * import React from 'react'
656
+ * import { useSelector } from 'react-redux'
657
+ *
658
+ * export const CounterComponent = () => {
659
+ * const counter = useSelector(state => state.counter)
660
+ * return <div>{counter}</div>
661
+ * }
639
662
  */
640
663
 
641
664
  const useSelector = /*#__PURE__*/createSelectorHook();
@@ -1106,11 +1129,11 @@ reactIs_development.typeOf = typeOf;
1106
1129
 
1107
1130
  if (process.env.NODE_ENV === 'production') ;
1108
1131
 
1109
- /**
1110
- * Hook factory, which creates a `useStore` hook bound to a given context.
1111
- *
1112
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
1113
- * @returns {Function} A `useStore` hook bound to the specified context.
1132
+ /**
1133
+ * Hook factory, which creates a `useStore` hook bound to a given context.
1134
+ *
1135
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
1136
+ * @returns {Function} A `useStore` hook bound to the specified context.
1114
1137
  */
1115
1138
 
1116
1139
  function createStoreHook(context = ReactReduxContext) {
@@ -1125,29 +1148,29 @@ function createStoreHook(context = ReactReduxContext) {
1125
1148
  return store;
1126
1149
  };
1127
1150
  }
1128
- /**
1129
- * A hook to access the redux store.
1130
- *
1131
- * @returns {any} the redux store
1132
- *
1133
- * @example
1134
- *
1135
- * import React from 'react'
1136
- * import { useStore } from 'react-redux'
1137
- *
1138
- * export const ExampleComponent = () => {
1139
- * const store = useStore()
1140
- * return <div>{store.getState()}</div>
1141
- * }
1151
+ /**
1152
+ * A hook to access the redux store.
1153
+ *
1154
+ * @returns {any} the redux store
1155
+ *
1156
+ * @example
1157
+ *
1158
+ * import React from 'react'
1159
+ * import { useStore } from 'react-redux'
1160
+ *
1161
+ * export const ExampleComponent = () => {
1162
+ * const store = useStore()
1163
+ * return <div>{store.getState()}</div>
1164
+ * }
1142
1165
  */
1143
1166
 
1144
1167
  const useStore = /*#__PURE__*/createStoreHook();
1145
1168
 
1146
- /**
1147
- * Hook factory, which creates a `useDispatch` hook bound to a given context.
1148
- *
1149
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
1150
- * @returns {Function} A `useDispatch` hook bound to the specified context.
1169
+ /**
1170
+ * Hook factory, which creates a `useDispatch` hook bound to a given context.
1171
+ *
1172
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
1173
+ * @returns {Function} A `useDispatch` hook bound to the specified context.
1151
1174
  */
1152
1175
 
1153
1176
  function createDispatchHook(context = ReactReduxContext) {
@@ -1159,26 +1182,26 @@ function createDispatchHook(context = ReactReduxContext) {
1159
1182
  return store.dispatch;
1160
1183
  };
1161
1184
  }
1162
- /**
1163
- * A hook to access the redux `dispatch` function.
1164
- *
1165
- * @returns {any|function} redux store's `dispatch` function
1166
- *
1167
- * @example
1168
- *
1169
- * import React, { useCallback } from 'react'
1170
- * import { useDispatch } from 'react-redux'
1171
- *
1172
- * export const CounterComponent = ({ value }) => {
1173
- * const dispatch = useDispatch()
1174
- * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
1175
- * return (
1176
- * <div>
1177
- * <span>{value}</span>
1178
- * <button onClick={increaseCounter}>Increase counter</button>
1179
- * </div>
1180
- * )
1181
- * }
1185
+ /**
1186
+ * A hook to access the redux `dispatch` function.
1187
+ *
1188
+ * @returns {any|function} redux store's `dispatch` function
1189
+ *
1190
+ * @example
1191
+ *
1192
+ * import React, { useCallback } from 'react'
1193
+ * import { useDispatch } from 'react-redux'
1194
+ *
1195
+ * export const CounterComponent = ({ value }) => {
1196
+ * const dispatch = useDispatch()
1197
+ * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
1198
+ * return (
1199
+ * <div>
1200
+ * <span>{value}</span>
1201
+ * <button onClick={increaseCounter}>Increase counter</button>
1202
+ * </div>
1203
+ * )
1204
+ * }
1182
1205
  */
1183
1206
 
1184
1207
  const useDispatch = /*#__PURE__*/createDispatchHook();
@@ -1555,6 +1578,39 @@ function isPlainObject(value) {
1555
1578
  }
1556
1579
  return proto === baseProto;
1557
1580
  }
1581
+ // src/createAction.ts
1582
+ function createAction(type, prepareAction) {
1583
+ function actionCreator() {
1584
+ var args = [];
1585
+ for (var _i = 0; _i < arguments.length; _i++) {
1586
+ args[_i] = arguments[_i];
1587
+ }
1588
+ if (prepareAction) {
1589
+ var prepared = prepareAction.apply(void 0, args);
1590
+ if (!prepared) {
1591
+ throw new Error("prepareAction did not return an object");
1592
+ }
1593
+ return __spreadValues(__spreadValues({
1594
+ type: type,
1595
+ payload: prepared.payload
1596
+ }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
1597
+ }
1598
+ return { type: type, payload: args[0] };
1599
+ }
1600
+ actionCreator.toString = function () { return "" + type; };
1601
+ actionCreator.type = type;
1602
+ actionCreator.match = function (action) { return action.type === type; };
1603
+ return actionCreator;
1604
+ }
1605
+ function isAction(action) {
1606
+ return isPlainObject(action) && "type" in action;
1607
+ }
1608
+ function isFSA(action) {
1609
+ return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
1610
+ }
1611
+ function isValidKey(key) {
1612
+ return ["type", "payload", "error", "meta"].indexOf(key) > -1;
1613
+ }
1558
1614
  /** @class */ ((function (_super) {
1559
1615
  __extends(MiddlewareArray, _super);
1560
1616
  function MiddlewareArray() {
@@ -1637,39 +1693,6 @@ function freezeDraftable(val) {
1637
1693
  process.env.NODE_ENV === "production";
1638
1694
  // src/configureStore.ts
1639
1695
  process.env.NODE_ENV === "production";
1640
- // src/createAction.ts
1641
- function createAction(type, prepareAction) {
1642
- function actionCreator() {
1643
- var args = [];
1644
- for (var _i = 0; _i < arguments.length; _i++) {
1645
- args[_i] = arguments[_i];
1646
- }
1647
- if (prepareAction) {
1648
- var prepared = prepareAction.apply(void 0, args);
1649
- if (!prepared) {
1650
- throw new Error("prepareAction did not return an object");
1651
- }
1652
- return __spreadValues(__spreadValues({
1653
- type: type,
1654
- payload: prepared.payload
1655
- }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
1656
- }
1657
- return { type: type, payload: args[0] };
1658
- }
1659
- actionCreator.toString = function () { return "" + type; };
1660
- actionCreator.type = type;
1661
- actionCreator.match = function (action) { return action.type === type; };
1662
- return actionCreator;
1663
- }
1664
- function isAction(action) {
1665
- return isPlainObject(action) && "type" in action;
1666
- }
1667
- function isFSA(action) {
1668
- return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
1669
- }
1670
- function isValidKey(key) {
1671
- return ["type", "payload", "error", "meta"].indexOf(key) > -1;
1672
- }
1673
1696
  // src/mapBuilders.ts
1674
1697
  function executeReducerBuilderCallback(builderCallback) {
1675
1698
  var actionsMap = {};
@@ -1686,8 +1709,11 @@ function executeReducerBuilderCallback(builderCallback) {
1686
1709
  }
1687
1710
  }
1688
1711
  var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1712
+ if (!type) {
1713
+ throw new Error("`builder.addCase` cannot be called with an empty action type");
1714
+ }
1689
1715
  if (type in actionsMap) {
1690
- throw new Error("addCase cannot be called with two reducers for the same action type");
1716
+ throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
1691
1717
  }
1692
1718
  actionsMap[type] = reducer;
1693
1719
  return builder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "8.3.0",
3
+ "version": "8.3.1",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,22 +9,22 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@mui/material": "5.12.0",
12
- "@opengeoweb/api": "8.3.0",
13
- "@opengeoweb/core": "8.3.0",
14
- "@opengeoweb/form-fields": "8.3.0",
15
- "@opengeoweb/shared": "8.3.0",
16
- "@opengeoweb/store": "8.3.0",
17
- "@opengeoweb/theme": "8.3.0",
18
- "@opengeoweb/webmap": "8.3.0",
19
- "@opengeoweb/webmap-react": "8.3.0",
12
+ "@opengeoweb/api": "8.3.1",
13
+ "@opengeoweb/core": "8.3.1",
14
+ "@opengeoweb/form-fields": "8.3.1",
15
+ "@opengeoweb/shared": "8.3.1",
16
+ "@opengeoweb/store": "8.3.1",
17
+ "@opengeoweb/theme": "8.3.1",
18
+ "@opengeoweb/webmap": "8.3.1",
19
+ "@opengeoweb/webmap-react": "8.3.1",
20
20
  "@redux-eggs/redux-toolkit": "2.2.0",
21
21
  "@redux-eggs/saga-extension": "2.2.0",
22
- "@reduxjs/toolkit": "1.9.5",
22
+ "@reduxjs/toolkit": "1.9.7",
23
23
  "axios": "1.5.0",
24
24
  "lodash": "4.17.21",
25
25
  "react": "18.2.0",
26
- "react-hook-form": "7.46.2",
27
- "react-redux": "8.1.2",
26
+ "react-hook-form": "7.47.0",
27
+ "react-redux": "8.1.3",
28
28
  "redux-saga": "1.2.3"
29
29
  },
30
30
  "module": "./index.esm.js",