Draft: failing suspense test#70
Conversation
|
Thanks for the PR lazakrisz I'll take a look |
No problem, I was also thinking whether this is an issue on bunshi's side or my app's side. I did a little bit more thorough explanation on the original issue: #69 (comment) |
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds a failing test case to demonstrate an issue where Suspense boundaries never resolve when using async atoms within molecules (as discussed in issue #69). The test specifically examines the behavior when ScopeProvider is positioned as a child of a Suspense boundary.
Key Changes
- Added three new test cases for async atom behavior with Suspense boundaries
- Added
react-domas a dev dependency - Added a debug test script for troubleshooting
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/react/ScopeProvider.test.tsx | Added three test cases examining promise atoms and Suspense boundary behavior with different component hierarchies |
| package.json | Added react-dom dev dependency and debug test script |
| } | ||
| }); | ||
|
|
||
| test("Promise atom changes from loading to hasData and contains sattled data", async () => { |
There was a problem hiding this comment.
Corrected spelling of 'sattled' to 'settled'.
| test("Promise atom changes from loading to hasData and contains sattled data", async () => { | |
| test("Promise atom changes from loading to hasData and contains settled data", async () => { |
| use(SuspenseScope); | ||
| lifecycle.connect(); | ||
|
|
||
| // dummy promise atom without lodable which should trigger suspense |
There was a problem hiding this comment.
Corrected spelling of 'lodable' to 'loadable'.
| // dummy promise atom without lodable which should trigger suspense | |
| // dummy promise atom without loadable which should trigger suspense |
| use(SuspenseScope); | ||
| lifecycle.connect(); | ||
|
|
||
| // dummy promise atom without lodable which should trigger suspense |
There was a problem hiding this comment.
Corrected spelling of 'lodable' to 'loadable'.
| // dummy promise atom without lodable which should trigger suspense | |
| // dummy promise atom without loadable which should trigger suspense |
| act, | ||
| waitFor, | ||
| renderHook, | ||
| getByText, |
There was a problem hiding this comment.
The imported getByText function is unused in this file. Consider removing it to keep imports clean.
| getByText, |
| useSetAtom, | ||
| } from "jotai"; | ||
| import React, { ReactNode, useContext, useEffect } from "react"; | ||
| import { atomWithObservable, loadable } from "jotai/vanilla/utils"; |
There was a problem hiding this comment.
The imported atomWithObservable function is unused in this file. Consider removing it to keep imports clean.
| import { atomWithObservable, loadable } from "jotai/vanilla/utils"; | |
| import { loadable } from "jotai/vanilla/utils"; |
Failing test case due to never resolving suspense boundary when using async atoms within molecules.
I added the failing test which is currently being discussed in #69 , currently this is just a draft pull request.
Type of change