hypothesis / h

Annotate with anyone, anywhere.
https://hypothes.is/
BSD 2-Clause "Simplified" License
2.96k stars 427 forks source link

Persist group details changes when switching tabs #9095

Closed robertknight closed 3 days ago

robertknight commented 4 days ago

When switching from the "Settings" tab to "Members" and back, persist changes to group settings.

This is done by extracting the saved group details from the config into a state value in the AppRoot component which is then passed down to the current route as a prop. The CreateEditGroupForm component then updates this value via a callback after changes are saved.

An alternative way to achieve this would be for the "Settings" tab to fetch the group details from the backend every time it is rendered via an API call, which is how the "Members" tab works. As an optimization, this could be skipped on the initial load if the details have been provided as part of the config.

Fixes https://github.com/hypothesis/h/issues/9087

Testing:

  1. In activity pages, go to an existing group and select "Edit group"
  2. Edit the name, description or type and click "Save changes"
  3. Navigate to the "Members" tab and then back to "Settings". The changes made in Step 2 should be persisted. Note the Members tab only works for open groups until https://github.com/hypothesis/h/pull/9085 lands.