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

Property FinalizationRegistry doesn't exist. #3643

Closed
lifeissummertime opened this issue Mar 4, 2023 · 7 comments · Fixed by #3645
Closed

Property FinalizationRegistry doesn't exist. #3643

lifeissummertime opened this issue Mar 4, 2023 · 7 comments · Fixed by #3645
Labels

Comments

@lifeissummertime
Copy link

lifeissummertime commented Mar 4, 2023

Intended outcome:
Should not occur this error on ios react native

Actual outcome:

IMG_4316

How to reproduce the issue: I tried to apply Mobx on an expo created react natice project. I don't think the environment has FinalizationRegistry.

Versions mobx-react-lite 3.4.1

"expo": "~48.0.5",
"expo-font": "~11.1.1",
"expo-linking": "~4.0.1",
"expo-splash-screen": "~0.18.1",
"expo-status-bar": "~1.4.4",
"expo-system-ui": "~2.2.1",
"expo-web-browser": "~12.1.1",
"mobx": "^6.8.0",
"mobx-react": "^7.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.3",
"react-native-screens": "~3.20.0",

Suggestion Maybe it works if in this way typeof FinalizationRegistry !== 'undefined'

image

image

@kubk
Copy link
Collaborator

kubk commented Mar 5, 2023

Hi, I am unable to reproduce the issue here: https://snack.expo.dev/vEF39Ohnb

The mobx-react-lite is 3.4.1 as you mentioned. It looks like your bundler doesn't use a bundled Mobx version. Its locations:

  • node_modules/mobx/dist/mobx.cjs.development.js (CommonJS dev)
  • node_modules/mobx/dist/mobx.cjs.production.min.js (CommonJS prod)
  • node_modules/mobx/dist/mobx.esm.development.js (ES6 dev)
  • node_modules/mobx/dist/mobx.esm.production.js (ES6 prod)

@urugator
Copy link
Collaborator

urugator commented Mar 5, 2023

Suggestion Maybe it works if in this way typeof FinalizationRegistry !== undefined

PR welcome

@lifeissummertime
Copy link
Author

Hi, I am unable to reproduce the issue here: https://snack.expo.dev/vEF39Ohnb

The mobx-react-lite is 3.4.1 as you mentioned. It looks like your bundler doesn't use a bundled Mobx version. Its locations:

  • node_modules/mobx/dist/mobx.cjs.development.js (CommonJS dev)
  • node_modules/mobx/dist/mobx.cjs.production.min.js (CommonJS prod)
  • node_modules/mobx/dist/mobx.esm.development.js (ES6 dev)
  • node_modules/mobx/dist/mobx.esm.production.js (ES6 prod)

Sorry for the late reply. This issue happened only on my real iphone device. It works well on web. I downgraded to 3.4.0 and it worked well.

@mweststrate
Copy link
Member

mweststrate commented Mar 5, 2023 via email

@lifeissummertime
Copy link
Author

I tried https://snack.expo.dev/vEF39Ohnb , and it worked well. My case is on debug mode, and the source code pointed to /node_modules/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js

I searched the package, and there are only two files. Quite strange, it only happens in debug mode?

image

@lifeissummertime
Copy link
Author

I temporarily modified the code and it worked well.

image

@lifeissummertime
Copy link
Author

lifeissummertime commented Mar 5, 2023

Suggestion Maybe it works if in this way typeof FinalizationRegistry !== undefined

PR welcome

Sorry, undefined may need to be quoted typeof FinalizationRegistry !== 'undefined'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants