Skip to content

Inconvenient __owner__ assignment prevents updating a component #557

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

Closed
sophiebits opened this issue Nov 17, 2013 · 0 comments · Fixed by #558
Closed

Inconvenient __owner__ assignment prevents updating a component #557

sophiebits opened this issue Nov 17, 2013 · 0 comments · Fixed by #558

Comments

@sophiebits
Copy link
Collaborator

Take a look at this component:


http://jsfiddle.net/spicyj/PLcWJ/

The second time you click to show the popover, React throws:

Invariant Violation: replaceProps(...): You called setProps or replaceProps on a component with an owner. This is an anti-pattern since props will get reactively updated when rendered. Instead, change the owner's render method to pass the correct value as props to the component where it is created.

This happens because the second time the line

React.renderComponent(content, $tip.find('.popover-content')[0]);

is executed, it calls .replaceProps on the old content component, which throws because its __owner__ is the PopoverDemo component, despite that PopoverDemo only creates the component, but doesn't actually mount it:

return <BsPopover content={<div>The time is <Time />.</div>} />;

I've concluded that __owner__ is the wrong thing for .replaceProps to check. Instead, some property should be set on each child component upon mounting, probably by ReactMultiChild.Mixin.mountComponent. (Or conversely, on each root component by ReactComponent.Mixin._mountComponentIntoNode.)

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 a pull request may close this issue.

1 participant