mobxjs / mobxjs/mobx-utils

Issue while updating view Model using setter method

Open
#308 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
130
PR merge metrics
No merged PRs in 30d

Description

Example Code

// STORE
class Todo {
  @observable title = "Test";

  @action.bound
  setTitle(value: string) {
    this.title = value;
  }
}

// CREATE VIEW MODEL
const model = new Todo();
const viewModel = createViewModel(model);

viewModel.setTitle("Updated Test") 
console.log(viewModel.title) // Updated Test
console.log(model.title) // Updated Test

Here when we console the original model we expected title value as "Test" only but actual output is "Updated Test"

package versions:
"mobx": "5.15.0",
"mobx-react": "6.1.4",
"mobx-utils": "5.6.2",

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example with the listed mobx, mobx-react, and mobx-utils versions, then start at the createViewModel entry point. Verify how calling the setter affects the view model and original model; done means the view model shows the updated title while the original remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.