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

Add ref attributes to enabling DOM access in Components #715

Merged
merged 1 commit into from
Nov 4, 2019

Conversation

jstarry
Copy link
Member

@jstarry jstarry commented Oct 21, 2019

Fixes: #665

  • Rename NodeCell to NodeRef
  • Add example project
  • Repurpose occupied node cell into a node reference for use in component lifecycle methods

Copy link
Member

@hgzimmerman hgzimmerman left a comment

Choose a reason for hiding this comment

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

Looks good.


I think that in high level documentation, when that comes into existence, should mention that this is a rare case where view is able to change the model's state (via a Rc<RefCell<_>>), despite only having a borrowed reference to the model. Because it isn't immediately obvious that mutation is possible there (and is the mechanism through which this feature is made possible) without explicitly bringing up the concept of interior mutability.

src/html/mod.rs Outdated Show resolved Hide resolved
src/html/mod.rs Outdated Show resolved Hide resolved
@jstarry jstarry merged commit c178d52 into yewstack:master Nov 4, 2019
@jstarry jstarry deleted the element-refs branch November 4, 2019 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for setting refs on elements for DOM reference
2 participants