We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3672e24 commit f187393Copy full SHA for f187393
react_ujs/index.js
@@ -188,18 +188,17 @@ var ReactRailsUJS = {
188
},
189
190
unmountRoot: function(node) {
191
- var targetRoots = this.roots.filter(
192
- function(rootElement) {
193
- return rootElement["node"] && (rootElement["node"] === node)
194
- }
195
- )
196
- targetRoots.forEach(
+ var targetRoot = this.findRoot(node);
+ if (targetRoot) {
+ return;
+ }
+
+ targetRoot["root"].unmount();
197
+ this.roots = this.roots.filter(
198
function(rootElement) {
- rootElement["root"].unmount();
199
- rootElement["root"] = null;
200
- rootElement["node"] = null;
+ return rootElement["node"] !== node
201
}
202
+ );
203
204
205
0 commit comments