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

Call measure function on leaf nodes even if the node does not have context #598

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

nicoburns
Copy link
Collaborator

Objective

Allow use of measure functions in cases where extra context information is not required.

Context

Notes

I believe this is a strict generalisation of functionality. If users want to return a zero size for cases where context is None they can do this within their measure function (and as node_context was already an Option<T> they would have to have done this anyway with the existing API).

@nicoburns nicoburns added usability Make the library more comfortable to use breaking-change A change that breaks our public interface labels Jan 2, 2024
@nicoburns nicoburns added this to the 0.4 milestone Jan 2, 2024
Copy link
Collaborator

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change: simplifies our code, rounds off a rough corner.

RELEASES.md wasn't updated :)

@nicoburns
Copy link
Collaborator Author

nicoburns commented Jan 2, 2024

RELEASES.md wasn't updated :)

Can't do that easily for this PR as the feature it changes also hasn't been added to RELEASES.md (oops). I'm on holiday this week, so I only have little bits of time. But hoping to get some time to focus on docs and release notes soon :)

@nicoburns nicoburns merged commit 563d5dc into DioxusLabs:main Jan 2, 2024
18 checks passed
@nicoburns nicoburns deleted the always-measure-leaf-nodes branch January 2, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change that breaks our public interface usability Make the library more comfortable to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It's not obvious that only nodes with context get their measure function called (Not sure if this is a bug)
2 participants