Skip to content

Commit

Permalink
🐛 Make tutorials from params have precedence over tutorials that shou…
Browse files Browse the repository at this point in the history
…ld pop up
  • Loading branch information
aslakihle committed Oct 23, 2024
1 parent 1eb95bb commit 95ff0f9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/providers/TutorialProvider/TutorialProviderInner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ const TutorialProviderInner: FC = () => {

useEffect(() => {
if (tutorialsForPath.length < 1) return;
const tutorialToRun = tutorialsForPath.find(
(item) =>
!window.localStorage.getItem(item.shortName) ||
(shortNameFromParams &&
tutorialsForPath.some(
(item) => item.shortName === shortNameFromParams
))

const tutorialToRunFromParams = tutorialsForPath.find(
(item) => item.shortName === shortNameFromParams
);
if (tutorialToRun) {
runTutorial(tutorialToRun);

const tutorialThatShouldPopUp = tutorialsForPath.find((item) => {
!window.localStorage.getItem(item.shortName) && item.willPopUp;

Check failure on line 101 in src/providers/TutorialProvider/TutorialProviderInner.tsx

View workflow job for this annotation

GitHub Actions / Lint / lint (21.x)

Expected an assignment or function call and instead saw an expression
});

if (tutorialToRunFromParams) {
runTutorial(tutorialToRunFromParams);
} else if (tutorialThatShouldPopUp) {
runTutorial(tutorialThatShouldPopUp);
}
}, [runTutorial, shortNameFromParams, tutorialsForPath]);

Expand Down

0 comments on commit 95ff0f9

Please sign in to comment.