Skip to content

explain why child renders cannot be equal #217

Open
@progrium

Description

@progrium

I've been adding slots to my template system for Vecty so you can do this:

type Example struct {
	vecty.Core
	Children vecty.List `vecty:"slot"`
}

used like this:

<Example>
  <child></child>
  <child></child>
</Example>

where Example might have a template like this:

<div class="example">
  <slot></slot>
</div>

The result would be:

<div class="example">
  <child></child>
  <child></child>
</div>

And this works fine without really any changes to Vecty which is great, HOWEVER when I do rerenders of Example I run into this error:
https://github.com/gopherjs/vecty/blob/master/dom.go#L508-L510

And I've tried doing shallow copies of Children elements and I'm sure I'm just not knowing how it all works well enough to do this right, but the only way I can get it to work so far is to remove that check. And everything seems to work fine. So I'm wondering why it's there? This might also help me figure out how to do this the right way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions