-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Bug found while working on #2912, but it turns out to happen on main, too. This only happens in dev, so it's very low priority.
console/app/forms/idp/create.tsx
Lines 77 to 89 in 5c393b4
useEffect(() => { | |
// When creating a SAML identity provider connection, the ACS URL that the user enters | |
// should always be of the form: http(s)://<silo>.sys.<suffix>/login/<silo>/saml/<name> | |
// where <silo> is the Silo name, <suffix> is the delegated domain assigned to the rack, | |
// and <name> is the name of the IdP connection | |
// The user can override this by unchecking the "Automatically generate ACS URL" checkbox | |
// and entering a custom ACS URL, though if they check the box again, we will regenerate | |
// the ACS URL. | |
const suffix = getDelegatedDomain(window.location) | |
if (generateUrl) { | |
form.setValue('acsUrl', `https://${silo}.sys.${suffix}/login/${silo}/saml/${name}`) | |
} | |
}, [form, name, silo, generateUrl]) |
This effect is causing the form to become dirty on initial mount, causing a nav confirm when you try to leave the form, even though you haven't done anything. Key facts:
- I know it's that
setValue
because when I comment it out the problem goes away - This is only true in development, where React's strict mode is running all effects twice, so it's probably some kind of race
- Adding
{ shouldDirty: false }
to thesetValue
does not help (setValue
docs)

Metadata
Metadata
Assignees
Labels
No labels