profile
viewpoint
Jiri Spac capaj @LeapLabs Brno, Czech republic https://twitter.com/capajj Yeaaaah what's haaappening? If you could get those TPS reports done before the end of the day, that would be great.

bokuweb/re-bulma 370

[Deprecated] 💎Bulma components for React

agrublev/angularLocalStorage 353

The simplest angular localStorage implementation you will ever use.

alexisvincent/systemjs-hot-reloader 214

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app

alexisvincent/systemjs-hmr 24

Hot Module Replacement for SystemJS

capaj/array-sugar 22

Tired of not having a last property on array in Javascript? Tired of not having contains method? This little script solves those.

capaj/angularLocalStorage 4

The simplest angular localStorage implementation you will ever use. No cookies fallback. Seriously-fuck cookies.

capaj/adisepo-xml-generator 1

simple CLI tool for submitting Czech financial tax forms

capaj/atom-standardjs-snippets 1

:zap: A collection of JavaScript snippets for Atom, Standard Style

bbktsk/lime-izard-server 0

Tinder for commuters

capaj/ADE 0

AngularJS Datatype Editors

issue commentmobxjs/mobx

Using spread operator on observable object remove some properties (function)

Duplicate of #2629 and #2586

pinonpierre

comment created time in an hour

issue commentmobxjs/mobx

Using spread operator on observable object remove some properties (function)

https://codesandbox.io/s/mobxbug-949dd

pinonpierre

comment created time in an hour

IssuesEvent

issue closedmobxjs/mobx

Using spread operator on observable object remove some properties (function)

Intended outcome:

Retrieve the object with all its properties when using the spread operator on a mobx observable

Actual outcome:

Retrieve the object without function properties when using the spread operator on a mobx observable

How to reproduce the issue:

export class TestStore {
    constructor() {
        makeObservable(this);
    }

    @observable
    test?: object;

    @action
    setTest(test: object) {
        this.test = test;
    }
}

In my React Component

    const myObject = {a: "a", b: "b", c: () => console.log("ok")};
    console.log("simple var:", {...myObject});

    testStore.setTest(myObject);
    console.log("mobx observable:", {...testStore.test});

Console output:

    simple var: {a: "a", b: "b", c: ƒ}
    mobx observable: {a: "a", b: "b"}

Versions

Doesn't work on the last version:

"mobx": "^6.0.4",
"mobx-react-lite": "^3.1.6",
"mobx-utils": "^6.0.1",

Works on the previous version:

"mobx": "^5.15.4",
"mobx-react-lite": "^2.0.7",
"mobx-utils": "^5.6.1",

Thanks

closed time in 3 hours

pinonpierre

issue commentmobxjs/mobx

Using spread operator on observable object remove some properties (function)

We no longer support MobX V4/V5. Please upgrade and try again.

pinonpierre

comment created time in 3 hours

issue openedmobxjs/mobx

Using spread operator on observable object remove some properties (function)

Intended outcome:

Retrieve the object with all its properties when using the spread operator on a mobx observable

Actual outcome:

Retrieve the object without function properties when using the spread operator on a mobx observable

How to reproduce the issue:

export class TestStore {
    constructor() {
        makeObservable(this);
    }

    @observable
    test?: object;

    @action
    setTest(test: object) {
        this.test = test;
    }
}

In my React Component

    const myObject = {a: "a", b: "b", c: () => console.log("ok")};
    console.log("simple var:", {...myObject});

    testStore.setTest(myObject);
    console.log("mobx observable:", {...testStore.test});

Console output:

    simple var: {a: "a", b: "b", c: ƒ}
    mobx observable: {a: "a", b: "b"}

Versions

Doesn't work on the last version:

"mobx": "^6.0.4",
"mobx-react-lite": "^3.1.6",
"mobx-utils": "^6.0.1",

Works on the previous version:

"mobx": "^5.15.4",
"mobx-react-lite": "^2.0.7",
"mobx-utils": "^5.6.1",

Thanks

created time in 3 hours

issue closedmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

In latest mobx-react-lite it seems that the reference pointer is no longer provided to the functional react component eventhough forwardRef: true is set in the options.

Works using regular React.forwardRef (works, ref is a valid reference):

React.forwardRef((props, ref) => { console.log('REF', ref) return <span /> })

Doesn't work anymore with mobx-react-lite (ref is always null):

observer((props, ref) => { console.log('REF', ref) return <span /> }, {forwardRef: true})

Intended outcome:

The provided reference should be valid and observer with {forwardRef: true} option should behave equally to using React.forwardRef.

We didn't change our code at all just upgraded mobx to 6x and mobx-react-lite to 3x

Actual outcome:

ref is null in observer component

Versions

"mobx": "^6.0.4", "mobx-react-lite": "^3.1.6",

closed time in 3 hours

alpfactory-alex

issue commentmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

You know, that's the usual story. People come in here, report bugs, don't bother with actual reproduction. We asked for it and suddenly "it works" :)

So I guess I am closing unless you can come up with a reproduction that shows the problem.

alpfactory-alex

comment created time in 3 hours

issue commentmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

Well fun fact.. I spent the time to rebuild and it seems to work fine:

https://codesandbox.io/s/smoosh-sun-74cne?file=/index.js

Not sure why all of the sudden it then stopped in our code after upgrading while exchanging the same call from observer((props, ref) => void, {forwardRef: true}) to React.forwardRef((props, ref) => void) works...

https://codesandbox.io/s/smoosh-sun-74cne?file=/index.js

alpfactory-alex

comment created time in 4 hours

startedcapaj/chokidar-socket-emitter

started time in 6 hours

issue commentmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

Yes, there was the one in the issue template ... https://codesandbox.io/s/minimal-mobx-react-project-ppgml

alpfactory-alex

comment created time in 8 hours

issue commentmobxjs/mobx

Cannot decorate undefined property with deep inheritance

Good call, thanks, but didn't work either (tried with the example).

uqee

comment created time in 10 hours

issue commentmobxjs/mobx

Cannot decorate undefined property with deep inheritance

As a work around, I think in principle it should work fine to not apply makeObservablein super classes when using decorators, and apply it in subclasses only. If subclassing is not guaranteed, a condition like if (this instanceof SuperClass) makeObservable(this)should work I'd expect

uqee

comment created time in 10 hours

issue commentmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

@FredyC Yes sure. Is there a codebox template I could directly use for this? I couldn't find one maybe I didn't look right.

alpfactory-alex

comment created time in 11 hours

issue commentmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

Thanks for the report, but without runnable minimal reproduction it will take a long time for someone to have a look into it. So if you have a capacity for it, can you provide one to expedite it?

alpfactory-alex

comment created time in a day

issue openedmobxjs/mobx

mobx-react-lite observer(, {forwardRef: true}) has no longer an effect

In latest mobx-react-lite it seems that the reference pointer is no longer provided to the functional react component eventhough forwardRef: true is set in the options.

Works using regular React.forwardRef:

React.forwardRef((props, ref) => { console.log('REF', ref) // ref is valid rendering this with a ref return <span /> })

Doesn't work anymore with mobx-react-lite (ref is always null):

observer((props, ref) => { console.log('REF', ref) // ref is always null in the same call return <span /> }, {forwardRef: true})

Intended outcome:

The provided reference should be valid and observer with {forwardRef: true} option should behave equally to using React.forwardRef.

We didn't change our code at all just upgraded mobx to 6x and mobx-react-lite to 3x

Actual outcome:

ref is null in observer component

Versions

"mobx": "^6.0.4", "mobx-react-lite": "^3.1.6",

created time in a day

fork sindresorhus/npmhub

:mag_right: A browser extension for exploring npm dependencies on GitHub repos

https://npmhub.org

fork in a day

startedfregante/ghat

started time in a day

created repositorysindresorhus/p-state

Inspect the state of a promise

created time in a day

issue commentmobxjs/mobx

Cannot decorate undefined property with deep inheritance

Also it fails without any overridable properties or even actions.

I've uncommented observbales/actions in B/C and commented out makeObservable in A and it doesn't throw in sandbox... If I uncomment everything it also doesn't throw... Whether everything is correctly converted to observable/computed/action I dunno...

uqee

comment created time in 2 days

issue commentmobxjs/mobx

Cannot decorate undefined property with deep inheritance

If class A is not empty it fails anyway, I couldn't find any relation with its content, so commented it for brevity. Also it fails without any overridable properties or even actions.

Seems like the class C's @computed causes the trouble and adding any other decorator alongside it is a possible workaround. I would have investigated @computed decorators further which seem somehow flawed.

uqee

comment created time in 2 days

fork terrorizer1980/react-tweet-embed

component that you supply tweet id and you'll get a tweet embed back, nothing more

fork in 2 days

issue commentmobxjs/mobx

Cannot decorate undefined property with deep inheritance

You shouldn't call makeObservable if there are no decorators/annotation (class A). Otherwise possibly similar issue to #2593. Subclassing currently isn't ideal, we are trying to come up with something less fragile. cAction = action(() => "cAction") should be a future-proof solution for arrow functions that needs to be overridable by subclass.

uqee

comment created time in 2 days

PR opened mobxjs/mobx

Next release

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

mobx@6.0.5

Patch Changes

🚨🚨🚨 If you are upgrading from V4/V5, please follow the migration guide.

+7 -6

0 comment

3 changed files

pr created time in 2 days

create barnchmobxjs/mobx

branch : changeset-release/main

created branch time in 2 days

push eventmobxjs/mobx

urugator

commit sha 989390d46bbe9941b61ac6c6d1292f96445e7cc3

Fix #2579 observable does not ignore class instances (#2594) * fix-2579 * add changeset Co-authored-by: Daniel K <FredyC@users.noreply.github.com>

view details

push time in 2 days

PR merged mobxjs/mobx

Fix #2579 observable does not ignore class instances

Fixes #2579

+28 -14

3 comments

3 changed files

urugator

pr closed time in 2 days

issue closedmobxjs/mobx

mobx-react(-lite) useLocalObservable will wrap a class instance in observable if make(Auto)Observable is not used

Context

I am migrating my boilerplates

  • from mobx v4/v5 mobx-react v6
  • to mobx v6, mobx-react v7

Intended outcome

I switched to mobxReact.useLocalObservable().

For some complex components, I have classes for local state. So I have adapted the code to have calls like mobxReact.useLocalObservable(() => new MyState())

While most of the time, make(Auto)Observable will be used, I also had the case where a class "in WIP" was just passing non observable data.

import * as mobx from 'mobx'

export default class AppSettingsVM {
  constructor ({rootStore}) {
    mobx.makeAutoObservable(this) // <- WITHOUT this line, the instance is turned into an observable and the app crashes
    this.settings = rootStore.coreStore.settings
  }
}

<!-- What you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem. -->

Actual outcome:

From the docs, if useLocalObservable returns a class instance, it should be kept as is, which is not what is happening here and leads to a crash.

How to reproduce the issue:

Use useLocalObservable where it returns a class instance that is not using mobx make(Auto)Observable.

Versions mobx v6, mobx-react v7

closed time in 2 days

AoDev

pull request commentmobxjs/mobx

Fix #2579 observable does not ignore class instances

I guess this is fine to merge with tests passing. I don't see anything wrong about it.

urugator

comment created time in 2 days

issue commentmobxjs/mobx

mobx-react(-lite) useLocalObservable will wrap a class instance in observable if make(Auto)Observable is not used

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

AoDev

comment created time in 2 days

more