Skip to content

Commit

Permalink
squash fixtures, remove mutation observer, doesnt seem like it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
flacoman91 committed Oct 16, 2024
1 parent ec712c2 commit 21c95bd
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/components/Tour/Tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,6 @@ export const Tour = () => {
expandable.dispatch('click');
}

const callBack = () => {
steps.forEach((step, idx) => {
if (ref.current !== null) {
ref.current.updateStepElement(idx);
}
});
};
const waitOn = new MutationObserver(callBack);
waitOn.observe(document.querySelector('#ccdb-ui-root'), {
subtree: true,
childList: true,
});

// Add listener to filter toggle if it's mobile and at step 4 or 7
const filterListener = () => {
// Make sure next button isn't being hidden from steps 3 or 7
Expand Down Expand Up @@ -157,6 +144,15 @@ export const Tour = () => {
return true;
}

/**
* wrapper function to only hide tour when it is visible
*/
function hideTour() {
if (showTour) {
dispatch(tourHidden());
}
}

return isPrintMode || isLoading ? null : (
// eslint-disable-next-line react/react-in-jsx-scope
<>
Expand All @@ -165,7 +161,7 @@ export const Tour = () => {
enabled={showTour}
initialStep={0}
steps={steps}
onExit={() => dispatch(tourHidden())}
onExit={() => hideTour()}
options={options}
onBeforeChange={() => handleBeforeChange(stepRef)}
onBeforeExit={() => handleBeforeExit(stepRef)}
Expand Down

0 comments on commit 21c95bd

Please sign in to comment.