Skip to content

Commit b58f139

Browse files
author
bfintal@gmail.com
committed
fix: if no tour id, do not render modal tour component
1 parent 8875e9f commit b58f139

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/guided-modal-tour/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ const GuidedModalTour = memo( props => {
7171
}
7272
}
7373

74+
// Do not load if there is no tourId.
75+
if ( ! tourId ) {
76+
return null
77+
}
78+
7479
// Only lazy-load ModalTour when we're actually going to render it
7580
const ModalTour = lazy( () => import( /* webpackChunkName: "modal-tour" */ '~stackable/lazy-components/modal-tour' ) )
7681

src/lazy-components/modal-tour/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const ModalTour = memo( props => {
5151
hasConfetti = true,
5252
initialize = NOOP,
5353
} = useMemo( () =>
54-
TOUR_STEPS[ tourId ],
54+
TOUR_STEPS[ tourId ] || {},
5555
[ tourId ] )
5656

5757
const {

src/plugins/guided-modal-tour/editor-block-tour.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const EditorBlockTour = () => {
1515
}
1616
}, [] )
1717

18+
// Do not load if there is no tourId.
19+
if ( ! tourId ) {
20+
return null
21+
}
22+
1823
return <>
1924
<GuidedModalTour tourId={ tourId } />
2025
</>

0 commit comments

Comments
 (0)