Questions tagged [mobx-utils]

12 questions
2
votes
1 answer

what is the difference between mobx's createTransformer and mobx-utils computedFn?

What is the difference between mobx's createTransformer and mobx-utils computedFn? Sometimes there is overlap between things in mobx and mobx-utils (ie whenWithTimeout) but when I've seen that in the past the later has been marked deprecated. …
Frank Schwieterman
  • 24,142
  • 15
  • 92
  • 130
1
vote
3 answers

Why does the component is not re-rendering when i add @action decorator to an react event handler function

Problem: The below react component is not re-rendering when I add @action decorator to the class member fn. import { observable, action } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; import { render } from…
Pavan Gangireddy
  • 417
  • 1
  • 3
  • 13
1
vote
1 answer

Difference between way of importing mobx

How does the following import make a difference? import { observer } from 'mobx-react/native' instead of import { observer } from 'mobx-react' Additional Information React Native version: ~0.48.4 React: 16.0.0 mobx-formatters:…
Pavan Gangireddy
  • 417
  • 1
  • 3
  • 13
1
vote
2 answers

MobX and HMR: Please avoid replacing stores as the change might not propagate to all children

I try to enable HMR on my project with typescript and webpack 2 but whenever I make a change I see the following output in the logs and the store is reset to its original values(discards state) index.js:832 MobX Provider: Provided store 'appStore'…
yesil
  • 697
  • 1
  • 9
  • 19
1
vote
0 answers

How to test fetch result in componentDidMount

I need to test if the state was set after promise resolved in componentDidMount class Todos extends React.Component { constructor(props) { super(props); this.state = {}; } componentDidMount() { const result =…
ridermansb
  • 10,779
  • 24
  • 115
  • 226
0
votes
1 answer

Result of function made by createTransformer from mobx-utils is not memoized

I am trying to implement computed getter function with argument like shown in this answer with MobX 6 and corresponding version of mobx-utils. export class CodificatorStore { @observable.ref items: Array | null = null; @action…
ezze
  • 3,933
  • 2
  • 34
  • 58
0
votes
2 answers

Implement Mobx ViewModel in React Component state

I want to use Mobx ViewModel (from mobx-utils) in a functional component in React. Well, My model in this case is a state. (e.g - company in the next line): const [company, setCompany] = useState(store.companyObservable) And according to that, the…
levi
  • 1,077
  • 2
  • 11
  • 24
0
votes
1 answer

Mobx React - CreateViewModel - Error - Object is not a function

I am trying to use the createViewModel from mobx-utils in a Mobx/React app. My Store is: export class CompanyStore extends StoreExt { @observable companyDetails: ICompanyDetails = {} } And when i use the 'createViewModel' function, in the…
levi
  • 1,077
  • 2
  • 11
  • 24
0
votes
1 answer

computed fromPromise with nested promises does not reevaluate when observable changes?

I'm running into this issue where I have certain computed values that are promises of promises, filtered on observables, which are not reevaluated when the observables it depends on changes. Here's an example, class CustomerStore { @observable…
agadzik
  • 41
  • 1
  • 7
0
votes
1 answer

How does garbage collection address async actions in mobx-utils?

I want a clear method for creating stores that I can refresh when I know new service data is available (like lazyObservable from mobx-utils), but easily attach more computed values and action functions. Starting from create-react-app, use this…
Sage Gerard
  • 1,311
  • 8
  • 29
0
votes
0 answers

How to solve error in mobX at npm start?

I get these errors in these files after NPM START. What should i do? ERROR in ./~/mobx-router/src/route.js ERROR in ./~/mobx-router/src/start-router.js ERROR in ./~/mobx-router/src/components/MobxRouter.js ERROR in…
Verquido
  • 99
  • 1
  • 7
0
votes
1 answer

Not understanding behavior of MobX-utils fromResource

This is a modified version of the now() implementation from mobx-utils. From my understanding, when the autorun function is triggered, "initial" would be logged, then after 1 second, the value of Date.now(), then Date.now() again and again every…
nickbreaton
  • 65
  • 1
  • 7