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

feat: use sessionStorage to save state of filters #751

Merged
merged 8 commits into from
Feb 1, 2024

Conversation

jashlu
Copy link
Contributor

@jashlu jashlu commented Dec 22, 2023

No description provided.

@jashlu jashlu requested a review from a team as a code owner December 22, 2023 01:26
@jashlu jashlu requested review from mbwatson and scrummish and removed request for a team December 22, 2023 01:26
Copy link

netlify bot commented Dec 22, 2023

Deploy Preview for gatsby-theme-project-portal-defaults ready!

Name Link
🔨 Latest commit 713f80e
🔍 Latest deploy log https://app.netlify.com/sites/gatsby-theme-project-portal-defaults/deploys/65b409aafb527500083127ee
😎 Deploy Preview https://deploy-preview-751--gatsby-theme-project-portal-defaults.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.

Copy link

netlify bot commented Dec 22, 2023

Deploy Preview for gatsby-theme-project-portal-ex-site ready!

Name Link
🔨 Latest commit 713f80e
🔍 Latest deploy log https://app.netlify.com/sites/gatsby-theme-project-portal-ex-site/deploys/65b409aa850ec90008a33196
😎 Deploy Preview https://deploy-preview-751--gatsby-theme-project-portal-ex-site.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.

Copy link

netlify bot commented Dec 22, 2023

Deploy Preview for project-portal-storybook ready!

Name Link
🔨 Latest commit 713f80e
🔍 Latest deploy log https://app.netlify.com/sites/project-portal-storybook/deploys/65b409aae89c9d000813509e
😎 Deploy Preview https://deploy-preview-751--project-portal-storybook.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.

@jashlu jashlu marked this pull request as draft December 22, 2023 02:10
Copy link

github-actions bot commented Dec 22, 2023

Note: This comment gets updated with every commit

Git SHA: 713f80ebd9ae8a78de64e117f64695aab8eeefe7

Site: example-site

Pa11y test status: PASS

 {
    "total": 21,
    "passes": 21,
    "errors": 0,
    "results": {
        "http://localhost:9000/project/completed-project-nodate/": [],
        "http://localhost:9000/project/completed-project/": [],
        "http://localhost:9000/project/completed-project2/": [],
        "http://localhost:9000/project/ongoing-project-nodate/": [],
        "http://localhost:9000/project/ongoing-project/": [],
        "http://localhost:9000/project/ongoing-project2/": [],
        "http://localhost:9000/project/open-project-2/": [],
        "http://localhost:9000/project/open-project-nodate/": [],
        "http://localhost:9000/project/open-project/": [],
        "http://localhost:9000/project/open-project3/": [],
        "http://localhost:9000/project/open-project4/": [],
        "http://localhost:9000/project/open-project5/": [],
        "http://localhost:9000/project/open-project6/": [],
        "http://localhost:9000/completed/": [],
        "http://localhost:9000/": [],
        "http://localhost:9000/ongoing/": [],
        "http://localhost:9000/open/": [],
        "http://localhost:9000/search/": [],
        "http://localhost:9000/about/": [],
        "http://localhost:9000/contact/": [],
        "http://localhost:9000/contact/thank-you/": []
    }
}
 

@jashlu jashlu marked this pull request as ready for review January 8, 2024 22:59
@jashlu jashlu requested review from hollandjg and hetd54 January 10, 2024 20:07
Copy link
Contributor

@hollandjg hollandjg left a comment

Choose a reason for hiding this comment

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

This works with the filters! Nice.

How easy would it be to include the results page number in here, so when you hit back it loads the page you were just on?

If it's easy, we could add that, if not let's make that into a separate Issue (and write down anything we know about the problem, any pitfalls we'd need to solve) and hand it over to the new keepers of the portal.

@jashlu
Copy link
Contributor Author

jashlu commented Jan 19, 2024

This works with the filters! Nice.

How easy would it be to include the results page number in here, so when you hit back it loads the page you were just on?

If it's easy, we could add that, if not let's make that into a separate Issue (and write down anything we know about the problem, any pitfalls we'd need to solve) and hand it over to the new keepers of the portal.

Hey John, thanks for the review/comments. So this is what Heather and I have been trying to tackle recently. To summarize quickly, it's hard for us to differentiate when a projectPage is being loaded because of

  1. pressing the back button and wanting to reload the state of filters/sorting, which may include different page number
  2. filters/sorting applied to the project page so we want to show a fresh set of projects, starting on page 1.

This is because of the use of useEffect hooks and useState variables. I think, as you suggest, it may be better to exclude storing page in the session in this PR and get this merged in. I can put in another issue documenting the challenge with adding page number. Again, thanks for taking a look!

@jashlu jashlu requested a review from hollandjg January 19, 2024 17:02
@hollandjg
Copy link
Contributor

I can put in another issue documenting the challenge with adding page number.

That sounds great. Thanks, Josh!

Copy link
Contributor

@hollandjg hollandjg left a comment

Choose a reason for hiding this comment

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

This seems to me well organized and thought through. Seems to work too. Thanks!

One last thing – it looks like your reformatter didn't run:
Screenshot 2024-01-19 at 13 54 53

The line breaks are a little wonky. Maybe rerun that (you might need to reconfigure your IDE) and then it should be good to go!

@jashlu jashlu requested a review from hollandjg January 19, 2024 19:25
Copy link
Contributor

@hollandjg hollandjg left a comment

Choose a reason for hiding this comment

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

I reran prettier locally – I think yours was configured differently. Looks good now!

@hollandjg hollandjg changed the title use sessionStorage to save page state between page visits feat: use sessionStorage to save page state between page visits Jan 26, 2024
@hollandjg hollandjg changed the title feat: use sessionStorage to save page state between page visits feat: use sessionStorage to save state of filters Jan 26, 2024
@jashlu
Copy link
Contributor Author

jashlu commented Feb 1, 2024

I reran prettier locally – I think yours was configured differently. Looks good now!

Thank you! Merging this in.

@jashlu jashlu added this pull request to the merge queue Feb 1, 2024
Merged via the queue into main with commit c2ccf94 Feb 1, 2024
15 checks passed
@jashlu jashlu deleted the feat-project-page-save-state branch February 1, 2024 15:59
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.

Route the 'back' button when viewing a project to the last viewed group of projects
2 participants