Skip to content

Use a selector to mount and unmount components at a given node #221

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

Merged
merged 1 commit into from
Mar 31, 2015

Conversation

jakegavin
Copy link
Contributor

I'm working on an app where we need to be able to manually unmount specific components when a modal is closed. This PR adds a searchSelector argument to ReactRailsUJS.mountComponents and ReactRailsUJS.unmountComponents which lets you target specific elements.

This is similar to #91. This functionality has been listed as a goal for 1.0 (#133) but the author of #91 hasn't responded in two months so I opened this PR.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@danott
Copy link
Contributor

danott commented Mar 25, 2015

👍 I've found myself reaching for this exact behavior multiple times.

@rmosolgo
Copy link
Member

Nice feature! Looks good to me, let me just give it a try locally with Turbolinks and without

@rmosolgo
Copy link
Member

Looks good in a local test app w/Turbolinks & without, and looks good in PCO Check-ins

@rmosolgo rmosolgo mentioned this pull request Mar 30, 2015
3 tasks
rmosolgo pushed a commit that referenced this pull request Mar 31, 2015
Use a selector to mount and unmount components at a given node
@rmosolgo rmosolgo merged commit 2731a71 into reactjs:master Mar 31, 2015
@rmosolgo
Copy link
Member

🎉 🎊 thanks!

@@ -115,13 +115,24 @@ class ViewHelperTest < ActionDispatch::IntegrationTest
assert page.has_content?('Hello Bob')
end

test 'react_ujs can unount at node' do
Copy link
Contributor

Choose a reason for hiding this comment

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

unmount

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.

5 participants