-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/ when switching to input mode from a referenced Border token, all… #2850
Conversation
… fields are now editable
🦋 Changeset detectedLatest commit: bcc2a28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
const setBorderValue = React.useCallback( | ||
(newBorderValue: SingleBorderToken['value']) => { | ||
if (internalEditToken?.type === TokenTypes.BORDER && typeof newBorderValue === 'object') { | ||
setInternalEditToken({ | ||
...internalEditToken, | ||
value: { ...newBorderValue }, | ||
}); | ||
} | ||
}, | ||
[internalEditToken], | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the relevant part of the change in this file, I ran prettier command before committing which made lots of formatting changes
<Stack gap={2} direction="column"> | ||
{Object.entries(internalEditToken.schema.schemas.value.properties ?? {}).map(([key], keyIndex) => ( | ||
<> | ||
<React.Fragment key={`border-input-fragment-${seed(keyIndex)}`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a react child unique key error, hence I replaced the blank fragment with a React Fragment(with a key)
if (mode === 'alias' && typeof internalEditToken.value === 'string') { | ||
setBorderValue(selectedToken?.rawValue ?? {}); | ||
} | ||
setMode(mode === 'input' ? 'alias' : 'input'); | ||
setAlias(''); | ||
}, [mode]); | ||
}, [mode, selectedToken, internalEditToken, setBorderValue]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pertinent change in this file. Lots of prettier formatting in this file as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing ❇️
Fixes #2823