MuckRock / documentcloud-frontend

DocumentCloud's front end source code - Please report bugs, issues and feature requests to info@documentcloud.org
https://www.documentcloud.org
GNU Affero General Public License v3.0
15 stars 5 forks source link

Update application in response to organization change #601

Closed allanlasser closed 3 weeks ago

allanlasser commented 1 month ago

When the user changes their current organization from the org menu (#602), the application will need to revalidate a bunch of data. This includes the manager sidebar ("Your Organization's Documents" filter), the permissions on which documents are visible, and the status of a user's premium account permissions and balances.

Since the organization menu will be present in the global navigation, the org can be switched from any route.

This may be as simple as calling invalidate on the current/affected route after switching.

eyeseast commented 1 month ago

I think some flavor of invalidate will handle this. Either we add a tag to the root layout -- see https://github.com/MuckRock/documentcloud-frontend/issues/602#issuecomment-2229502329 -- or we just do invalidateAll, which might be effectively the same thing.

This is going to cause a ton of data to reload, but I don't think there's a way around that. Anything that depends on a user's org for access becomes invalid, and that's just a lot of stuff.