by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:52
    MoonBall commented #2415
  • 02:47
    coveralls commented #2429
  • 02:46
    MoonBall commented #2415
  • 02:43
    gitpod-io[bot] commented #2429
  • 02:43
    gitpod-io[bot] edited #2429
  • 02:43
    MoonBall opened #2429
  • 02:42

    MoonBall on add-makeObservable-to-the-non-type-import

    fix: makeObservable gets added … (compare)

  • Aug 11 23:12
    barbalex commented #2423
  • Aug 11 22:50
    bobinrinder commented #2423
  • Aug 11 12:37
    MoonBall edited #2428
  • Aug 11 12:37
    MoonBall edited #2428
  • Aug 11 12:36
    gitpod-io[bot] commented #2428
  • Aug 11 12:36
    gitpod-io[bot] edited #2428
  • Aug 11 12:36
    MoonBall opened #2428
  • Aug 11 12:32

    MoonBall on no-actions-when-is-computing

    Don't call Action while Compute… (compare)

  • Aug 10 14:29
    MoonBall commented #2346
  • Aug 10 12:27
    charliematters commented #2415
  • Aug 10 12:09
    MoonBall commented #2415
  • Aug 10 12:01
    MoonBall commented #2422
  • Aug 10 12:00
    MoonBall commented #2422
Hardik Kaji
@hardikkaji
@FredyC I have fixed issue by using useObserver instead of observer(SomeComponent)
Daniel K.
@FredyC
@hardikkaji That sounds silly to modify app code to have working tests...
useObserver has its own tradeoffs you will probably discover later
Hardik Kaji
@hardikkaji
So @FredyC What's recommend to use for observing component?
Daniel K.
@FredyC
um observer? :)
but you need ask over at Enzyme what they don't like about it
Hardik Kaji
@hardikkaji
I have asked them also but they are not replying :D
Daniel K.
@FredyC
what do expect? it's open-source, you are not paying for 24/7 support ...
Hardik Kaji
@hardikkaji
Yeah I know :)
But thanks for your support and reply :) it was really helpful to my team :)
Hardik Kaji
@hardikkaji
Hello, Is there any hack to make MobX Devtools to work in iFrame?
Michel Weststrate
@mweststrate
I'm not even sure they work in normal circumstances :P
Ivan V.
@ivandotv
Looking into xstate and mobx, I've found a demo on codesandbox that uses fromStream from mobx-utils however
that function is not documented, but it is exported. Is it safe to use?
https://github.com/mobxjs/mobx-utils/search?q=fromStream&unscoped_q=fromStream
Hardik Kaji
@hardikkaji
@mweststrate :P anyways i managed to work in iframe :)
Michel Weststrate
@mweststrate
@ivandotv yeah I think so. Feel free to fix the docs to make it published
Henri Maurer
@hmaurer
Hi! Quick question: is there a nice way to use Mobx with Vue3? (the composition API)
Nickolay Platonov
@canonic-epicure
hello!
another cool feature of ChronoGraph, something to support in Mobx too? shorturl.at/cwxLY
Adam Stankiewicz
@sheerun_gitlab
@mweststrate Have you thought about using class Something extends Observable { } instead of makeObservable for MobX 6?
With inferred properties it would be really elegant. No constructor necessary
Also annotating fields could happen as static property
Daniel K.
@FredyC
@sheerun_gitlab check the mobxjs/mobx#2325 ... it was suggested couple of times already
Adam Stankiewicz
@sheerun_gitlab
okay, got it
Adam Stankiewicz
@sheerun_gitlab
const { makeAutoObservable, autorun } = require('mobx');

const doubler = makeAutoObservable({
  value: 1,
  get double() {
    return this.value * 2
  },
  increment() {
    this.value++
  }
})

autorun(() => {
  console.log(doubler.double)
})

doubler.increment()
Looks nice actually
const { makeAutoObservable, autorun } = require('mobx');

const Doubler = (value) => makeAutoObservable({
  value,
  get double() {
    return this.value * 2
  },
  increment() {
    this.value++
  }
})

const doubler = Doubler(1)

autorun(() => {
  console.log(doubler.double)
})

doubler.increment()
also nice
maybe makeAutoObservable could accept function and automatically make class from it
because class instances are far less expensive in JS (methods are on prototype, not on object)
Dr Danyo
@DrDanyo_twitter
Has anyone had any success using TestCafe to e2e test a page using Mobx? In particular, observables based on localstate don't seem to be updating/firing when the localstate is updated via runInAction.
Michel Weststrate
@mweststrate
e2e tests should be unrelated to your implementation details, so I assume it either wouldn't work without the e2e test either, or their is something wrong with your build setup etc
@sheerun_gitlab declaring members and making them observable is exactly what observable(obj) already does. As far as creating a function that generates a class goes, I don't see any benefit of that above just declaring a class :) achieves the same thing, without confusing transformations, allowing statics, instanceof checks etc.
function implementations can be shared without classes as well, just hoist them
Dr Danyo
@DrDanyo_twitter
Thanks, I'll see if we can investigate further, it seems when running a headless browser the render does not happen but does when using a full browser. Is there any minimum browser config that is required for mobx renders to occur.
Michel Weststrate
@mweststrate
I'd check your console errors, might be that your headless isn't providing some build in api
Robin
@rluiten
I am trying out mobx state tree, is this the right place to ask about a typescript related error I am seeing with the Mobx values function?
I was playing around created a small app that retrieves values from a map and renders them to do list start and the types for values seem like they might have a problem?
Daniel K.
@FredyC
@rluiten you are right there is some inconsistency, looks like mobx.values yields an array with items that can be also undefined and it's complaining because of that
can you please file the issue in mobx repo?
Adam Stankiewicz
@sheerun_gitlab
@mweststrate Indeed, following works too. Awesome
class Doubler {
  constructor(value) {
    this.value = value
  }
  get double() {
    return this.value * 2
  }
  increment() {
    this.value++
  }
}

const doubler = makeAutoObservable(new Doubler(2))

autorun(() => {
  console.log(doubler.double)
})

doubler.increment()
Dr Danyo
@DrDanyo_twitter

Thanks, I'll see if we can investigate further, it seems when running a headless browser the render does not happen but does when using a full browser. Is there any minimum browser config that is required for mobx renders to occur.

Thanks for the help on this one, turned out to be an issue with a vpn.

Robin
@rluiten
Thanks, @FredyC created issue - mobxjs/mobx#2422
charliematters
@charliematters
This is probably a question with an obvious answer, but why do onBecomeObserved and onBecomeUnobserved support all observable types except objects? I'm trying to do something like this and I'm struggling:
const tokenDetails = observable({ token: null, expiryMs: null })

onBecomeObserved(tokenDetails, () => { ... })
onBecomeUnobserved(tokenDetails, () => { ... })
Daniel K.
@FredyC
@charliematters whole object is never observable, only its properties, I think you would need Map instead
charliematters
@charliematters
Fair enough!
Les Szklanny
@AjaxSolutions
Hi!
What would the easiest way to set up a reaction inside a store created by using the useLocalStore hook?
Andrey Boldyrev
@runnez
@AjaxSolutions I suppose it isn't possible, especially we should dispose reaction on a component unmount, so you need to set it up inside useEffect hook
aharon-vish
@aharon-vish
Hey,
Andrey Boldyrev
@runnez
Hi Mobx-nation!
I've just accomplished a proof of concept yet another model library for Mobx :)
It's a tiny helper for TS users who likes the class approach and doesn't need the full power of MST or keystone.
Also it's battle-tested. We built a huge app using the JS version. But TS version was just baked :)
Feedback is welcome 🙏