-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
test(solid-query) Add test for transition #4224
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 399f18e:
|
Hi, let's wait for @ardeora to review your change, but in the meantime:
thank you 🙏 |
Hi @TkDodo. Test case added, hope it helps! |
Thanks! Yeah this a very interesting/smart approach. I had looked at something similar before but the current implementation worked fine. Though, I'm curious as to which exact part of the current implementation is breaking transitions. I'm at work right now. But will take a deeper look at it in a few hours. |
return true | ||
}) | ||
|
||
return <div>{state.data ? 'Message' : 'never'}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that still breaks (even with the current implementation) is that if you use the Show
component instead so
<Show when={state.data}>
<div>Message</div>
</Show>
still doesn't work 😭 There's maybe something goofy over here with solid js not resolving the reactivity correctly. I'm trying to create a minimal reproduction of where things are going wrong, but it'll take me more time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true :( But I believe this must be fixed in solid-js
core.
This however works:
<div>
<Show when={state.data}>
<div>Message</div>
</Show>
</div>
It seems that the conditional component always needs to be wrapped in another one and Fragment
doesn't help here either.
For this one I'd expect something wrong in the transformations made by X-plugin-solid
packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (along with the Show
) issue seem to be fixed in solid-js
already: solidjs/solid@ea2c976, though not released yet. Currently my fix breaks the <Show when={...}
case 😂 , so how should we proceed with this?
I believe that the test case could still be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes! Thanks for creating an issue with Ryan about this. I built the latest version and it seems like I can get it working fine (current implementation) with the new fixes Ryan implemented. I will let solid-js push a new release out to solve this upstream issue. However, the transitions tests would be really useful. I would suggest only adding tests in this pull request for now :D Let me know if you have any questions or concerns!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our CI wont let us publish until all tests pass. So for now can we make it it.skip
. I'll go back ad remove the skip when we have a new solid-js version out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left only the test & updated the commit message.
@TkDodo We are looking good with this PR. @jeski-bright added a new test for solid-js transitions. The upstream issue should be fixed in a few days and we can unskip the test then. Feel free to merge 😄 Or do you suggest we hold on to this PR until the upstream issue is fixed? |
@ardeora since this PR only adds a skipped test, I would wait until the upstream issue is fixed and then merge the test when we actually run it. |
Since Ryan released those changes, updated solid to 1.5.7 and enabled the test. Please double check this, as during the first run of the test suite I got 1 failing test: |
Codecov ReportBase: 96.36% // Head: 96.94% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #4224 +/- ##
==========================================
+ Coverage 96.36% 96.94% +0.58%
==========================================
Files 45 86 +41
Lines 2281 3273 +992
Branches 640 881 +241
==========================================
+ Hits 2198 3173 +975
- Misses 80 98 +18
+ Partials 3 2 -1 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@TkDodo The changes are looking good here and |
Yes I fixed this in my other PR. Sorry, I should port the fix directly to main. Will do later today. |
No worries! Thanks for the quick reply. Thanks @jeski-bright! We'll get this merged when CI is fixed |
it's merged. please update with main to make the pipeline work :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the empty file named change
please? can we remove that?
Sorry for that, must've been checking something. Removed. |
Add test for running a query during transition.
ChangecreateResource
usage to only indicate the suspended loading state. Always serve the underlying data from the query state. Do not trigger mutations and refetches as often.This is a workaround for the following issue: solidjs/solid#1249.