@elliemae/pui-app-sdk 5.1.0 → 5.1.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.
@@ -24,19 +24,15 @@ __export(helpers_exports, {
24
24
  module.exports = __toCommonJS(helpers_exports);
25
25
  var import_toolkit = require("@reduxjs/toolkit");
26
26
  var import_lodash = require("lodash");
27
- var import_react = require("react");
28
27
  const getApiActionCreator = (api) => (operation) => ({
29
28
  [operation]: (0, import_toolkit.createAction)(`${api}/${operation}`),
30
29
  [`${operation}Success`]: (0, import_toolkit.createAction)(`${api}/${operation}Success`),
31
30
  [`${operation}Error`]: (0, import_toolkit.createAction)(`${api}/${operation}Error`)
32
31
  });
33
- const getSelectField = (stateName) => (fieldName = "", defaultValue) => (state = {}, stateValue = (0, import_lodash.get)(state, stateName)) => {
34
- const finalDefaultValue = (0, import_react.useMemo)(() => defaultValue, []);
35
- return Array.isArray(fieldName) ? fieldName.map(
36
- (field, i) => (0, import_lodash.get)(
37
- stateValue,
38
- field,
39
- Array.isArray(finalDefaultValue) ? finalDefaultValue[i] : finalDefaultValue
40
- )
41
- ) : (0, import_lodash.get)(stateValue, fieldName, finalDefaultValue);
42
- };
32
+ const getSelectField = (stateName) => (fieldName = "", defaultValue) => (state = {}, stateValue = (0, import_lodash.get)(state, stateName)) => Array.isArray(fieldName) ? fieldName.map(
33
+ (field, i) => (0, import_lodash.get)(
34
+ stateValue,
35
+ field,
36
+ Array.isArray(defaultValue) ? defaultValue[i] : defaultValue
37
+ )
38
+ ) : (0, import_lodash.get)(stateValue, fieldName, defaultValue);
@@ -1,21 +1,17 @@
1
1
  import { createAction } from "@reduxjs/toolkit";
2
2
  import { get } from "lodash";
3
- import { useMemo } from "react";
4
3
  const getApiActionCreator = (api) => (operation) => ({
5
4
  [operation]: createAction(`${api}/${operation}`),
6
5
  [`${operation}Success`]: createAction(`${api}/${operation}Success`),
7
6
  [`${operation}Error`]: createAction(`${api}/${operation}Error`)
8
7
  });
9
- const getSelectField = (stateName) => (fieldName = "", defaultValue) => (state = {}, stateValue = get(state, stateName)) => {
10
- const finalDefaultValue = useMemo(() => defaultValue, []);
11
- return Array.isArray(fieldName) ? fieldName.map(
12
- (field, i) => get(
13
- stateValue,
14
- field,
15
- Array.isArray(finalDefaultValue) ? finalDefaultValue[i] : finalDefaultValue
16
- )
17
- ) : get(stateValue, fieldName, finalDefaultValue);
18
- };
8
+ const getSelectField = (stateName) => (fieldName = "", defaultValue) => (state = {}, stateValue = get(state, stateName)) => Array.isArray(fieldName) ? fieldName.map(
9
+ (field, i) => get(
10
+ stateValue,
11
+ field,
12
+ Array.isArray(defaultValue) ? defaultValue[i] : defaultValue
13
+ )
14
+ ) : get(stateValue, fieldName, defaultValue);
19
15
  export {
20
16
  getApiActionCreator,
21
17
  getSelectField
@@ -51,7 +51,10 @@ export declare const getApiActionCreator: (api: string) => (operation: string) =
51
51
  * import { selectSomeState } from 'slices/some-slice';
52
52
  * import { useSelector, shallowEqual } from 'react-redux';
53
53
  *
54
- * export const useSelectSomeState = (fieldName, defaultValue) => useSelector(selectSomeState(fieldName, defaultValue), shallowEqual);
54
+ * export const useSelectSomeState = (fieldName, defaultValue) => {
55
+ * const finalDefaultValue = useMemo(() => defaultValue, []);
56
+ * useSelector(selectSomeState(fieldName, defaultValue), shallowEqual);
57
+ * }
55
58
  *
56
59
  * // some-component.js
57
60
  * import { useSelectSomeState } from 'custom-hooks/state-selectors.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",