Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

StateWrapper doesn't do set_state when using []= #174

Open
@zetachang

Description

@zetachang

Here is a falling test case

it 'is supposed to work' do
  k = Class.new {
    include React::Component
    before_mount do
      state[:foo] = 'bar'
    end

    def render
      div { state.foo }
    end
  }
  expect(k).to render('<div>bar</div>')
end

The current implementation only update the cached Hash of the backing state. I think this is a bug and could be fixed by actually invoking State.set_state.

/cc @catmando

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions