-
Notifications
You must be signed in to change notification settings - Fork 575
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
@realm/react causes an error during render phase (jest) and realmjs version 10.21.1 is missing a module during test (Jest) #5011
Comments
@codelearnerrr Thank you for taking the time to report. The issue with v10.21.1 is that a migration to Github Actions broke our Windows builds. It has been fixed in v10.22.0. From the second error message it looks like you are using |
@kneth . Thank you for taking the time to answer. After updating realm to 11.0.0, the If i understood correctly, the issue #4762 deals with asserting the Realm Provider after its rendered. The jest
Besides the act warning, its slow too. What should i do to fix it? |
By reading https://reactjs.org/docs/test-utils.html#act I think that wrapping it with |
Alright, @kneth. I tried to wrapp render within So, is there anything that can be changed within @realm/react to fix the issue of:
PS: By reading the |
@codelearnerrr Unfortunately, simply rendering I would recommend using Hope this helps. Let us know if you are still having issues. |
@takameyer thank you for taking the time to answer.
|
@codelearnerrr I ran your code and the warning about act is indeed there. The tests only took 1 second to run, so I'm not seeing an issue with speed here. I will investigate if we can get the warnings to disappear, but it's not as trivial as it seems. The RealmProvider will change state almost immediately after it is rendered, and somehow this isn't being registered in the act. According to this issue, the warning is a mild annoyance, but not an actual error that one should worry about. Also, one should not wrap |
There was a possible optimisation pointed out by issue #5011 For local realm, we could just immediately open a new realm instance if the sync configuration is not set. This would skip the fallback procedure. It also fixes the jest warning the user was seeing.
@codelearnerrr I have a PR that will fix this (#5074). I read into it, and it since the realm is being set by an async function, it is difficult for act to determine that the state change has finished within a render. This fix sets the realm immediately for local realms. I feel this is a good optimisation to have anyway, as this would remove a possible flicker when rendering the app on slower devices. |
There was a possible optimisation pointed out by issue #5011 For local realm, we could just immediately open a new realm instance if the sync configuration is not set. This would skip the fallback procedure. It also fixes the jest warning the user was seeing.
So, i will consider this issue as solved. That's all. |
There was a possible optimisation pointed out by issue #5011 For local realm, we could just immediately open a new realm instance if the sync configuration is not set. This would skip the fallback procedure. It also fixes the jest warning the user was seeing.
How frequently does the bug occur?
All the time
Description
Hello, RealmJs team. Thank you for this open source library. During integration testing (using Jest), these two problems happened:
The specified module could not be found. \?\C:\Users\code_\Downloads\training\realmJest\node_modules\realm\build\Release\realm.node
The module exists in node_modules, Jest just had a hard time trying to find it.
Stacktrace & log output
Can you reproduce the bug?
Yes, always
Reproduction Steps
repository with the problems mentioned
To reproduce the first issue:
To reproduce the second issue:
Version
10.21.1 and 10.20.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Android 10
Build environment
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: