Skip to content
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

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

mdroidian
Copy link
Collaborator

@mdroidian mdroidian requested a review from dvargas92495 March 26, 2024 23:32
Comment on lines 311 to 312
if (_label)
return getPageTitleByPageUid(initialUid) || getTextByBlockUid(initialUid);
Copy link
Collaborator

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?

Copy link
Collaborator Author

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);
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@mdroidian mdroidian merged commit 7a40cd2 into main Mar 27, 2024
1 check passed
@mdroidian mdroidian deleted the canvas-dialog-load-actual-node-title branch March 27, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants