mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem When editing the events a webhook endpoint is subscribed to and clicking save, the event checkboxes flip back to the previously saved selection while the save is in progress. The saved endpoint has the correct events, but the sheet shows the wrong ones. Closes FE-5275. ## Solution The edit sheet resets its form whenever the event types it receives change. The page built that list as a new array on every render, so any re-render of the page counted as a change. Clicking save puts the mutation into its pending state, which re-renders the page, which reset the form to the old saved events. - Memoized the event type options in the page, so the array only changes when the scope changes. - Added tests that hold the save request open and check the checkboxes while it is pending: one for unchecking an event and one for adding an event. Both failed before the change. ## How to test 1. Open a webhooks page and select an endpoint that is subscribed to all events. 2. Click Edit, uncheck a few events, and click Save changes. 3. Check that the unchecked events stay unchecked while the sheet is saving, and that the endpoint shows the events you picked afterwards. 4. Edit an endpoint that is subscribed to only one or two events, check an extra event, and click Save changes. 5. Check that the extra event stays checked while the sheet is saving, and that the endpoint shows it afterwards. 6. Try the same on an organization webhooks page.