-
Notifications
You must be signed in to change notification settings - Fork 54
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
v3 #1423
base: main
Are you sure you want to change the base?
Conversation
People can be co-author:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: -5.26 kB (-7.62%) ✅ Total Size: 63.8 kB
ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1423 +/- ##
==========================================
+ Coverage 77.21% 79.40% +2.18%
==========================================
Files 71 67 -4
Lines 597 573 -24
Branches 132 126 -6
==========================================
- Hits 461 455 -6
+ Misses 129 113 -16
+ Partials 7 5 -2
|
🦋 Changeset detectedLatest commit: 124238c The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Poco <[email protected]> Co-authored-by: Juhyeok Kang <[email protected]>
…error (#1409) 🚧 This PR could make a huge difference, so please help us make sure this change gets a very thorough review. 🚧 ```tsx const Throw = { Error: ({ message, after = 0, children }: PropsWithChildren<{ message: string; after?: number }>) => { const [isNeedThrow, setIsNeedThrow] = useState(after === 0) if (isNeedThrow) { throw new Error(message) } useTimeout(() => setIsNeedThrow(true), after) return <>{children}</> } } const Example = () => ( <ErrorBoundary fallback={() => <>This is expected</>}> <ErrorBoundary fallback={() => ( <Throw.Error message={ERROR_MESSAGE} after={100}> ErrorBoundary's fallback before error </Throw.Error> )} > <Throw.Error message={ERROR_MESSAGE} after={100}> ErrorBoundary's children before error </Throw.Error> </ErrorBoundary> </ErrorBoundary> ) ``` ## Problem: ErrorBoundary's fallback can't be treated by parent ErrorBoundary <!-- A clear and concise description of what this pr is about. --> Thrown Error in fallback will be caught by ErrorBoundary self and then expose fallback recursively 🥲 1. ErrorBoundary's children before error 2. ErrorBoundary's fallback before error 3. ErrorBoundary's fallback before error 4. ErrorBoundary's fallback before error 5. ... expose fallback self recursively ... ## Solution: When we meet thrown error in fallback of ErrorBoundary wrap it as InternalFallbackError, re-throw InternalFallbackError.fallbackError, if it is InternalFallbackError Thrown Error in fallback will be caught by parent ErrorBoundary 👍 1. ErrorBoundary's children before error 2. ErrorBoundary's fallback before error 3. This is expected ## PR Checklist - [x] I did below actions if need 1. I read the [Contributing Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md) 5. I added documents and tests. --------- Co-authored-by: Lee HyunJae (whale) <[email protected]> Co-authored-by: lucas0530 <[email protected]> Co-authored-by: HYUNGU KANG <[email protected]> Co-authored-by: Brian Vaughn <[email protected]>
close #1108 close #1349 close #1325
Suspensive v3
PR Checklist