allow changing the number of root nodes
This commit is contained in:
1 parent
e5a5850354
commit
4c1fe1d9bb
6 files changed
+112
-21
No files matched your search
@@ -25,6 +25,10 @@ impl<'b> VirtualDom {
|
||||
|
||||
/// Create this template and write its mutations
|
||||
pub(crate) fn create(&mut self, node: &'b VNode<'b>) -> usize {
|
||||
// Intialize the root nodes slice
|
||||
node.root_ids
|
||||
.intialize(vec![ElementId(0); node.template.get().roots.len()].into_boxed_slice());
|
||||
|
||||
// The best renderers will have templates prehydrated and registered
|
||||
// Just in case, let's create the template using instructions anyways
|
||||
if !self.templates.contains_key(&node.template.get().name) {
|
||||
@@ -213,7 +217,7 @@ impl<'b> VirtualDom {
|
||||
fn load_template_root(&mut self, template: &VNode, root_idx: usize) -> ElementId {
|
||||
// Get an ID for this root since it's a real root
|
||||
let this_id = self.next_root(template, root_idx);
|
||||
template.root_ids[root_idx].set(Some(this_id));
|
||||
template.root_ids.set(root_idx, this_id);
|
||||
|
||||
self.mutations.push(LoadTemplate {
|
||||
name: template.template.get().name,
|
||||
|
||||
Reference in new issue
Block a user