Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix isPlainObject (#3197) #3198

Merged
merged 3 commits into from
Dec 15, 2021
Merged

Fix isPlainObject (#3197) #3198

merged 3 commits into from
Dec 15, 2021

Conversation

urugator
Copy link
Collaborator

@urugator urugator commented Nov 27, 2021

Fixes #3197

isPlainObject compares stringified proto constructor with Object constructor, however we did not make sure that the constructor is actually own property of the prototype. Therefore in cases where constructor was not defined, like Object.create({}), we were comparing constructor inherited from Object, leading to false positive.

lodash impl for reference:
https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12036

@changeset-bot
Copy link

changeset-bot bot commented Nov 27, 2021

🦋 Changeset detected

Latest commit: a5becaa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mobx Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@urugator urugator merged commit 9b90e25 into mobxjs:main Dec 15, 2021
@github-actions github-actions bot mentioned this pull request Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

makeAutoObservable doesn't work with Object.create
1 participant