atom / etch

Builds components using a simple and explicit API around virtual-dom
MIT License
555 stars 57 forks source link

Virtual DOM gets updated but actual element doesnt #77

Closed nousacademy closed 6 years ago

nousacademy commented 6 years ago
/** @jsx etch.dom */

const etch = require('etch')

class MyComponent {
  constructor (properties) {
    this.properties = properties
    etch.initialize(this)
  }

  render () {
    return <div>{this.properties.greeting} World!</div>
  }

  update (newProperties) {
    if (this.properties.greeting !== newProperties.greeting) {
      this.properties.greeting = newProperties.greeting
      return etch.update(this)
    } else {
      return Promise.resolve()
    }
  }
}

// in an async function...

let component = new MyComponent({greeting: 'Hello'})
console.log(component.element.outerHTML) // ==> <div>Hello World!</div>
await component.update({greeting: 'Salutations'})
console.log(component.element.outerHTML)

Im using this exact same sample and its not working, the virtualNode object gets update, but the actual text of the element isnt!

nousacademy commented 6 years ago

screen shot 2018-04-23 at 2 20 20 pm

I'm puzzled

nousacademy commented 6 years ago

figured it out nvm