mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-03 08:45:40 +02:00
Fixed a bug where mentions don't show up in descripotions (#2099)
This commit is contained in:
parent
22aa8e591d
commit
d86d5005f6
@ -56,9 +56,19 @@ const MarkdownEditorInput = (props: Props): ReactElement => {
|
||||
return generateEditorState(initialText)
|
||||
})
|
||||
|
||||
const [initialTextCache, setInitialTextCache] = useState<string | undefined>(initialText)
|
||||
|
||||
// avoiding stale closure
|
||||
useEffect(() => {
|
||||
setEditorState(generateEditorState(initialText))
|
||||
// only change editor state when initialText actually changes from one defined value to another.
|
||||
// This is needed to make the mentions plugin work. For some reason, if we don't check
|
||||
// for this if condition here, mentions don't work. I suspect it's because without
|
||||
// the in condition, we're changing editor state twice during component initialization
|
||||
// and for some reason it causes mentions to not show up.
|
||||
if (initialText && initialText !== initialTextCache) {
|
||||
setEditorState(generateEditorState(initialText || ''))
|
||||
setInitialTextCache(initialText)
|
||||
}
|
||||
}, [initialText])
|
||||
|
||||
const [isMentionPopoverOpen, setIsMentionPopoverOpen] = useState(false)
|
||||
|
Loading…
Reference in New Issue
Block a user