@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
|
|
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
|
-
|
|
42828
|
-
|
|
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 =
|
|
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