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

Issue with using boolean() from refine pckg #1922

Closed
enisze opened this issue Jul 25, 2022 · 8 comments
Closed

Issue with using boolean() from refine pckg #1922

enisze opened this issue Jul 25, 2022 · 8 comments
Assignees
Labels
bug Something isn't working build / infra Component: refine related to refine

Comments

@enisze
Copy link

enisze commented Jul 25, 2022

TypeError: (0 , _recoiljs_refine__WEBPACK_IMPORTED_MODULE_0__.boolean) is not a function

This error happened while generating the page. Any console logs will be displayed in the terminal window.

This happens in the urlSyncEffect / syncEffect in an atom effects prop.
Using number() or string() does not cause any problem. Just boolean. Any ideas?

@zoeyfyi
Copy link

zoeyfyi commented Aug 5, 2022

I get a similar error

Failed to compile.

Attempted import error: 'boolean' is not exported from '@recoiljs/refine' (imported as 'refine').

Code to reproduce: https://runkit.com/embed/3o2k1gs2vx3i

@osiux
Copy link

osiux commented Aug 17, 2022

Seems like something on the build process strips this export. The result is that every build (cjs, es, umd) has no export of the boolean function. Unfortunately haven't been able to find why this happens.

@drarmstr drarmstr added bug Something isn't working build / infra Component: refine related to refine labels Aug 17, 2022
@drarmstr
Copy link
Contributor

Interesting. This issue doesn't show up with our internal builds so it looks like something with the open source build. boolean() is exported the same as number() and string(), but boolean is actually a reserved word in JS. So, that may likely be the issue. I think we'll have to find an alternative name for it. (cc @bsouthga)

drarmstr added a commit to drarmstr/Recoil that referenced this issue Aug 17, 2022
Summary:
Resolves facebookexperimental#1922

Rename `boolean()` checker to `bool()` since `boolean` is a reserved word in JS and the export was not working for the open source build.

While this might be considered a breaking API change, we can argue it's only a semantic version patch number update since the previous export didn't actually work so this is still just a bug fix.

Differential Revision: D38800113

fbshipit-source-id: 69fd0e8a369fdfecf5996f306f461ae8379b0245
@drarmstr drarmstr self-assigned this Aug 17, 2022
drarmstr added a commit to drarmstr/Recoil that referenced this issue Aug 17, 2022
Summary:
Resolves facebookexperimental#1922

Rename `boolean()` checker to `bool()` since `boolean` is a reserved word in JS and the export was not working for the open source build.

While this might be considered a breaking API change, we can argue it's only a semantic version patch number update since the previous export didn't actually work so this is still just a bug fix.

Differential Revision: D38800113

fbshipit-source-id: 1eed2f8845e99c5ec465bf1569fdc4d75d016d0a
facebook-github-bot pushed a commit that referenced this issue Aug 18, 2022
Summary:
Pull Request resolved: #1959

Refine 0.1.1 release:

- Rename `boolean()` export to `bool()` since `boolean` is a reserved word (#1922, #1962)
- Remove reference to `native` directory in `package.json` to cleanup errors for `react-native`. (#1931)
- Export `Path` class for custom checkers. (#1950, #1956)
- Extend the failure message of `union()` and `or()` with each type. (#1961)

Reviewed By: bsouthga

Differential Revision: D38764896

fbshipit-source-id: 5eb0327ab9034f3f0802796d986fd6e7df28f05c
@nichita-pasecinic
Copy link

nichita-pasecinic commented Aug 18, 2022

Hi @drarmstr,

I've got a issue with boolean, I see that the changes are in 0.1.1 so I presume in 0.1.0 it should be the same boolean exported

using:

"recoil": "^0.7.4",
"recoil-sync": "^0.1.0",
"@recoiljs/refine": "^0.1.0",

Error:

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@recoiljs_refine.js?v=b8e3ff52' does not provide an export named 'boolean' (at atoms.ts:23:1)

image

@osiux
Copy link

osiux commented Aug 18, 2022

@nichita-pasecinic the new exported names is bool, since boolean is a reserved word.

@nichita-pasecinic
Copy link

nichita-pasecinic commented Aug 18, 2022

@osiux I got it, but when the new release will be published (0.1.1.) ?

with 0.1.1-alpha.1 version I still have only boolean being exported

@osiux
Copy link

osiux commented Aug 18, 2022

my bad! I misread your question. On 0.1.0 it should be boolean, but an error in the build process with the reserved word made the export not existing in that release. On 0.1.1 is gonna be named bool. As for when it's gonna be released, that's a good question. I thought it was already released, but seems like it doesn't: https://www.npmjs.com/package/@recoiljs/refine?activeTab=versions I guess only recoil folks can know when it's gonna be released.

@drarmstr
Copy link
Contributor

Hopefully today.

@drarmstr drarmstr linked a pull request Aug 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build / infra Component: refine related to refine
Projects
None yet
5 participants