@truedat/core 4.41.2 → 4.41.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.41.3] 2022-04-01
4
+
5
+ ### Changed
6
+
7
+ - [TD-4670] `RouteListener` now dismisses alerts when any change of URL path
8
+ occurs
9
+
3
10
  ## [4.41.2] 2022-03-30
4
11
 
5
12
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.41.2",
3
+ "version": "4.41.3",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -106,5 +106,5 @@
106
106
  "react-dom": ">= 16.8.6 < 17",
107
107
  "semantic-ui-react": ">= 0.88.2 < 2.1"
108
108
  },
109
- "gitHead": "de1e8cd9c744c0dae85be4585fccc1c50fdf6a07"
109
+ "gitHead": "946829496288ea4ff05b3029b37d8c8d16393127"
110
110
  }
@@ -11,10 +11,7 @@ export class RouteListener extends React.Component {
11
11
  componentDidUpdate(prevProps) {
12
12
  const prevPath = prevProps.location.pathname;
13
13
  const currentPath = this.props.location.pathname;
14
- if (
15
- !_.isEmpty(this.props.message) &&
16
- prevPath.split("/")[1] !== currentPath.split("/")[1]
17
- ) {
14
+ if (!_.isEmpty(this.props.message) && prevPath !== currentPath) {
18
15
  this.props.dismissAlert();
19
16
  }
20
17
  }
@@ -27,10 +24,10 @@ export class RouteListener extends React.Component {
27
24
  RouteListener.propTypes = {
28
25
  location: PropTypes.object,
29
26
  message: PropTypes.object,
30
- dismissAlert: PropTypes.func
27
+ dismissAlert: PropTypes.func,
31
28
  };
32
29
 
33
- const mapStateToProps = state => ({ message: getMessage(state) });
30
+ const mapStateToProps = (state) => ({ message: getMessage(state) });
34
31
 
35
32
  const mapDispatchToProps = { dismissAlert };
36
33
 
@@ -5,7 +5,7 @@ import { RouteListener } from "../RouteListener";
5
5
  describe("<RouteListener />", () => {
6
6
  const props = {
7
7
  message: {},
8
- location: { pathname: "/test" }
8
+ location: { pathname: "/test" },
9
9
  };
10
10
 
11
11
  it("matches the latest snapshot", () => {
@@ -20,7 +20,7 @@ describe("<RouteListener />", () => {
20
20
  );
21
21
  wrapper.setProps({
22
22
  message: { not: "empty" },
23
- location: { pathname: "/different" }
23
+ location: { pathname: "/different" },
24
24
  });
25
25
  expect(dismissAlert.mock.calls.length).toBe(1);
26
26
  });
@@ -31,19 +31,7 @@ describe("<RouteListener />", () => {
31
31
  <RouteListener dismissAlert={dismissAlert} {...props} />
32
32
  );
33
33
  wrapper.setProps({
34
- location: { pathname: "/different" }
35
- });
36
- expect(dismissAlert.mock.calls.length).toBe(0);
37
- });
38
-
39
- it("when changing subpath location with message will not call dismissAlert", () => {
40
- const dismissAlert = jest.fn();
41
- const wrapper = shallow(
42
- <RouteListener dismissAlert={dismissAlert} {...props} />
43
- );
44
- wrapper.setProps({
45
- message: { not: "empty" },
46
- location: { pathname: "/test/different" }
34
+ location: { pathname: "/different" },
47
35
  });
48
36
  expect(dismissAlert.mock.calls.length).toBe(0);
49
37
  });