1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-12-21 20:06:40 +01:00

fix: don't attempt to get fetch strategies for new context fields on every key stroke (#11152)

Only renders the "ContextFieldUsage" component in the context form when
the form is in edit mode. It doesn't make sense to render it for context
fields that don't exist yet.

Rendering this in the create form caused the Unleash to send a request
to `/api/admin/context/:contextName/strategies` every time the name of
the context field changes (i.e. every key stroke).
This commit is contained in:
Thomas Heartman 2025-12-16 17:34:51 +01:00 committed by GitHub
parent 7369977b23
commit 62314aa66c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -262,7 +262,9 @@ export const ContextForm: React.FC<IContextForm> = ({
/>
<Typography>{stickiness ? 'On' : 'Off'}</Typography>
</StyledSwitchContainer>
<ContextFieldUsage contextName={contextName} />
{mode === 'Edit' ? (
<ContextFieldUsage contextName={contextName} />
) : null}
</div>
<StyledButtonContainer>
{children}