@equinor/echo-framework 0.14.1-beta-2 → 0.14.1-beta-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/index.js CHANGED
@@ -42805,13 +42805,14 @@ var style = {"echoEventContainer":"EchoEventHandler-module_echoEventContainer__h
42805
42805
  * @return {*}
42806
42806
  */
42807
42807
  const EchoEventHandler = ({
42808
- children
42808
+ children,
42809
+ history
42809
42810
  }) => {
42810
- const history = useHistory();
42811
+ const historyFromHook = useHistory();
42811
42812
  const touchEvents = useLongPress(copyText, 800);
42812
42813
  useEffect(() => {
42813
42814
  const unsubscribe = eventHub.subscribe(EchoEvents.PlantChanged, plantEvent => {
42814
- handlePlantChanged(plantEvent.selectedPlant, history, plantEvent.stayOnPath);
42815
+ handlePlantChanged(plantEvent.selectedPlant, historyFromHook || history, plantEvent.stayOnPath);
42815
42816
  });
42816
42817
  return () => {
42817
42818
  unsubscribe();
@@ -42824,12 +42825,13 @@ const EchoEventHandler = ({
42824
42825
  };
42825
42826
  }, []);
42826
42827
  useEffect(() => {
42827
- if (!history) {
42828
- console.error('No react history found!', history);
42828
+ const historyToUse = historyFromHook || history;
42829
+ if (!historyToUse) {
42830
+ console.error('No react history found!', historyToUse);
42829
42831
  return;
42830
42832
  }
42831
42833
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42832
- const unListen = history.listen(location => {
42834
+ const unListen = historyToUse.listen(location => {
42833
42835
  const {
42834
42836
  pathname
42835
42837
  } = location;
@@ -42839,7 +42841,7 @@ const EchoEventHandler = ({
42839
42841
  return () => {
42840
42842
  unListen();
42841
42843
  };
42842
- }, [history]);
42844
+ }, [historyFromHook, history]);
42843
42845
  return jsx("div", Object.assign({
42844
42846
  className: style.echoEventContainer
42845
42847
  }, touchEvents, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.14.1-beta-2",
3
+ "version": "0.14.1-beta-3",
4
4
  "peerDependencies": {
5
5
  "@equinor/echo-base": ">= 0.6.12 < 0.7.0",
6
6
  "@equinor/echo-components": ">= 0.7.0 < 0.8.0",
@@ -1,5 +1,7 @@
1
+ import { History } from 'history';
1
2
  import React from 'react';
2
3
  interface EchoEventHandlerProps {
4
+ history?: History;
3
5
  children: React.ReactNode;
4
6
  }
5
7
  /**