animl-frontend
animl-frontend copied to clipboard
Only fetch one Project at a time
Context
With the introduction of SpeciesNet (which has ~2500 classes), the Projects payloads exploded in size because each class needs a config record under Project.automationRules.action.categoryConfig. We discovered that when users with superuser permissions (who had access to all ~70 Projects) loaded the app, the payload return getProjects exceeded the maximum 6MB limit. We implemented a medium-term fix, which should allow us to 10x the number of Projects, we can support before this happens again, but we should implement a more permanent solution at some point.
Solution
A more permanent solution would probably involve just fetching the currently selected Project, rather than fetching all of the Projects a user has access to. We had initially attempted this approach in this PR, but abandoned it because the logic was proving somewhat complex and difficult to reason about, mostly due to the router. The logic in the ProjectAndViewNav.jsx probably needs reconsidering and simplifying.