Skip to content
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

[FIX] allow users to use the browser-back button #650

Merged
merged 11 commits into from
Dec 1, 2023
Merged

[FIX] allow users to use the browser-back button #650

merged 11 commits into from
Dec 1, 2023

Conversation

surchs
Copy link
Contributor

@surchs surchs commented Nov 29, 2023

Changes proposed in this pull request:

A lot of the stuff in the store around route handling and pages is already taken care of by the router. This PR essentially removes all of this stuff and replaces it with functions from the router

One big issue with the old system was that it only looked to the store to find out what page it was currently on. so if I use the browser back button this is not reflected in the store, but the route changes. So I could end up e.g. on the home page with a state that thinks I'm on the annotation page.

So we can make this both easier and have it not break anymore

  • add pageOrder in the store (tricky to do in the router)
  • renamed index.vue to home.vue -> so the route name works out
  • added test for nav-bar

Checklist

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see https://neurobagel.org/contributing/pull_requests for more info)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

Copy link

netlify bot commented Nov 29, 2023

Deploy Preview for neurobagel-annotator ready!

Name Link
🔨 Latest commit f0f4af2
🔍 Latest deploy log https://app.netlify.com/sites/neurobagel-annotator/deploys/656a41c42a7b360008b6ae48
😎 Deploy Preview https://deploy-preview-650--neurobagel-annotator.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rmanaem rmanaem self-requested a review November 29, 2023 21:42
Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done @surchs! Handling of routes is elegant and easy to understand.
Aside from the comments, I have two 🍒

  • I think we can remove getNextPage and setCurrentPage from the store.
  • I'd suggest adding a test for using the browser back button to one of the e2e tests.

nuxt.config.js Show resolved Hide resolved
layouts/default.vue Show resolved Hide resolved
Also remove some unnecessary cypress comands
@surchs surchs requested a review from rmanaem November 30, 2023 19:41
@surchs
Copy link
Contributor Author

surchs commented Nov 30, 2023

The e2e test for validate-output-example-synthetic-e2etest.cy.jsjust failed and then passed when rerun. So we're still not quite done with the flaky tests it seems

Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot to remove getNextPage and setCurrentPage from the store and add a test for the browser back button.

@surchs
Copy link
Contributor Author

surchs commented Dec 1, 2023

@rmanaem can you confirm where you still see getNextPage and setCurrentPage in the store? I saw them in the test and removed them there.

@surchs surchs requested a review from rmanaem December 1, 2023 15:07
@rmanaem
Copy link
Contributor

rmanaem commented Dec 1, 2023

can you confirm where you still see getNextPage and setCurrentPage in the store?

getNextPage(p_state) {
let nextPage = "";
switch ( p_state.currentPage ) {
case "home":
nextPage = "categorization";
break;
case "categorization":
nextPage = "annotation";
break;
case "annotation":
nextPage = "download";
break;
case "download":
nextPage = "";
break;
}
return nextPage;
},

setCurrentPage(p_state, p_pageName) {
p_state.currentPage = p_pageName;
},

Copy link
Contributor

@rmanaem rmanaem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @surchs! 🧑‍🍳

@surchs surchs merged commit 0ea87e3 into main Dec 1, 2023
8 checks passed
@surchs surchs deleted the issue619 branch December 1, 2023 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add warning not to use browser back button [ENH] Add component test for tool-navbar
2 participants