Skip to content

Fix/hints #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix router edge case
Signed-off-by: shmck <[email protected]>
  • Loading branch information
ShMcK committed Jul 1, 2020
commit ce08fa6d7f99a79b79b1a75234769579303854df
6 changes: 5 additions & 1 deletion web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import SelectTutorialPage from './containers/SelectTutorial'
import CompletedPage from './containers/Tutorial/CompletedPage'
import TutorialPage from './containers/Tutorial'

/*
* NOTE: due to a lack of URLs and a dependency on xstate
* we have to implement a custom router here
*/
const Routes = () => {
const { context, route, send } = useStateMachine()

Expand Down Expand Up @@ -35,7 +39,7 @@ const Routes = () => {
<Route paths={{ Tutorial: { Level: { Load: true } } }}>
<LoadingPage text="Loading Level..." processes={context.processes} />
</Route>
<Route paths={{ Tutorial: { LoadNext: true, Level: true } }}>
<Route paths={{ Tutorial: { Level: true } }}>
<TutorialPage send={send} context={context} />
</Route>
{/* Completed */}
Expand Down
4 changes: 4 additions & 0 deletions web-app/src/components/Router/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const matches = (route: string, paths: object): boolean => {
for (const key of keys) {
const next = current[key]
if (next) {
// exit early if property value is true
if (next === true) {
return true
}
current = next
continue
} else {
Expand Down