Skip to content

Commit 04ed4eb

Browse files
fix main view selection for dead views
1 parent 616bec4 commit 04ed4eb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

assets/js/phoenix_live_view/live_socket.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ export default class LiveSocket {
364364
let view = this.newRootView(body)
365365
view.setHref(this.getHref())
366366
view.joinDead()
367-
if(!this.main){ this.main = view }
367+
// When there's a rootViewSelector it's not appropriate for document.body to be the
368+
// main view since all the connected elements must be scoped under that selector
369+
if(!this.main && !this.rootViewSelector){this.main = view }
368370
window.requestAnimationFrame(() => view.execNewMounted())
369371
}
370372
}

0 commit comments

Comments
 (0)