-
Notifications
You must be signed in to change notification settings - Fork 5
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
get current roam node content when dialog opens #240
Conversation
if (_label) | ||
return getPageTitleByPageUid(initialUid) || getTextByBlockUid(initialUid); |
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.
why does truthiness of _label
dictate to use data from initialUid instead?
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.
it's a proxy for "Is this a new canvas node or an existing canvas node?"
If it is existing, get most up to date node content.
If it's new, get the specification
text instead
It's not used elsewhere so I renamed it to isExistingCanvasNode
const [label, setLabel] = useState(initialValue.text); | ||
const [label, setLabel] = useState(""); | ||
useEffect(() => { | ||
setLabel(initialLabel); |
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.
I think bc _label
updates, initialLabel
updates, so doesn't this fire on every keystroke?
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.
I think _label
only updated when shape.props.title
changed, which is onSuccess
of the dialog.
https://www.loom.com/share/09f71b10c61b4dbaa8aad2bbb61f0308
Regardless, testing this showed that it was firing for every node on canvas load. Changed it to fire on isOpen
https://www.loom.com/share/cf6b07dcce304f59b5a7425ce383724b