question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mobx-react-form is not compatible with MobX 6.1

See original GitHub issue

mobx-react-form is not compatible with MobX 6.1. The @action decorator does not apply to some methods.

Example:

import { autorun } from "mobx";
import MobxReactForm from "mobx-react-form";

const form = new MobxReactForm({
  fields: {
    note: {
      value: "Foo"
    }
  }
});

autorun(() => {
  console.log(form.$("note").value);
});

form.$("note").set("Bar");

Console output:

Foo 
[MobX] Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: Field@5.$value 
Bar 

CodeSandbox: https://codesandbox.io/s/angry-ganguly-t4f4i.

The problem is the use of mixins https://github.com/foxhound87/mobx-react-form/blob/master/src/index.js#L5-L30. I created a playground in which you can experiment with this without diving into the implementation details of the mobx-react-form https://codesandbox.io/s/mobx-react-form-mixins-playground-sbt0c.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
vkrolcommented, May 26, 2021

@rafaeldsousa I’m waiting for feedback from @foxhound87 😃

1reaction
rdgcocommented, Oct 5, 2021

@smiley-uriux - please see my latest PR. I’m with you, this mobx ecosystem is really important. I’ve also been updating mobx-router.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - MobX 6 | React Not Found Function - Stack Overflow
I have attached the output to the attached picture. What would be the reason? import {observable, computed, action, makeObservable} from 'mobx'; ...
Read more >
Enabling decorators · MobX
Decorator syntax and Create React App (v2). Decorators are only supported out of the box when using TypeScript in create-react-app@^2.1.1 and newer. In ......
Read more >
Handling React Forms with Mobx Observables
Learn a single approach to handle React forms with Mobx observables without using an already existing form library.
Read more >
mobx-react | Yarn - Package Manager
React bindings for MobX. ... Package with React component wrapper for combining React with MobX. ... Make mobx-react compatible with TS 4.8+ ...
Read more >
mobx-react/CHANGELOG.md - UNPKG
The CDN for mobx-react. ... 3, ### 6.1.2 ... 45, - Changing the set of stores in `Provider` is no longer supported and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found