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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[checkbox] useMixedCheckbox logs unexpected dev warning in testing #763

Open
themoor88 opened this issue Mar 15, 2021 · 9 comments
Open
Labels
Help Wanted Extra attention is needed Type: Bug Something isn't working

Comments

@themoor88
Copy link

themoor88 commented Mar 15, 2021

NOTE: As of 0.15.1 this should be a dev warning instead of an error, but I haven't had time to investigate the root cause.

-- Chance


馃悰 Bug report

Current Behavior

This is my checkbox component.
image

This is my test.
image

This is what happens when I run the test.
image

Expected behavior

I am not using the useMixedCheckbox at all in my component yet my test errors out here.

Your environment

Reach Package - Checkbox v0.13.2
React -v17.0.1
Browser - Chrome -Version 88.0.4324.192 (Official Build) (x86_64)
Node - v14.9.0
Operating System - macOS Big Sur v11.2.3

@themoor88
Copy link
Author

Does anyone have any idea for this issue? Bump.

@chaance
Copy link
Member

chaance commented Mar 30, 2021

@themoor88 Do you get this error in any other situation than testing?

@chaance chaance added Help Wanted Extra attention is needed Type: Bug Something isn't working labels Mar 30, 2021
@themoor88
Copy link
Author

No. It's only when I run tests.

@WojciechMatuszewski
Copy link

My first guess is that you need to wrap the act of creating the component with act to let React run all the initial effects (useEffect callbacks).

Will look into this tomorrow morning.

@chaance chaance changed the title Testing CustomCheckbox Component but useMixedCheckbox throws an error [checkbox] Testing CustomCheckbox Component but useMixedCheckbox throws an error Mar 30, 2021
@themoor88
Copy link
Author

@WojciechMatuszewski Any update on this? I tried to use act but had no luck.

@WojciechMatuszewski
Copy link

@WojciechMatuszewski Any update on this? I tried to use act but had no luck.

Sorry for not answering initially, a lot of things is going on at my workplace.

Could you please provide a codesandbox link / screenshot of how you modified your test?

I should be able to take a look during the weekend. Sorry again.

@chaance
Copy link
Member

chaance commented Apr 1, 2021

I think this can also just be a console warning instead of throwing TBH. We could silence it in a test env the same as we do with checking styles, or at least improve the message to make it easier to debug.

@chaance
Copy link
Member

chaance commented Apr 7, 2021

I haven't had time to investigate the root issue here, but FYI the update I just released logs a warning instead of throwing. This might still be a bit annoying but hopefully less disruptive still than the error.

@chaance
Copy link
Member

chaance commented Apr 20, 2021

As of 0.15.1 this should just be a warning.

@chaance chaance changed the title [checkbox] Testing CustomCheckbox Component but useMixedCheckbox throws an error [checkbox] useMixedCheckbox logs unexpected dev warning in testing Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Extra attention is needed Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants