animl-frontend
animl-frontend copied to clipboard
Fix issue with Projects in state after creating new projects
... However, I'm noticing another related bug. It's a little odd and I'm not sure how consequential so I'm not sure how much time to dedicate towards a fix, but the gist is:
- for a super user to access the animl.camera/create-project form, they would either have to be signed in already or navigate to animl.camera/app and sign in to get their JWT with their creds. After being authenticated, the
ProjectAndViewNav.jsxcomponent looks to see if there are any projects in state, and if not, it fetches them. So at this point the user would presumably have some projects already in state. - if they they want to create a project, they'd have to manually type out that URL because there's no link to it, and when they navigate there it's a page refresh the projects get removed from state.
- once the user successfully creates a project, that gets added to the state, BUT if they then navigate back to the app using the "application" nav link, the state is preserved and the
ProjectAndViewNav.jsxcomponent sees that there are already projects in the state so it doesn't re-fetch them.
There are probably some fairly straightforward ways to fix this (maybe instead of housing the create-projects form on a separate page, we put it in a modal), but I am not overly concerned about this so I think let's call it good enough for now.
Originally posted by @nathanielrindlaub in https://github.com/tnc-ca-geo/animl-frontend/pull/154#discussion_r1369277595