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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(suspensive.org): add ErrorBoundaryGroup examples using sandpack #1002

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

kangju2000
Copy link
Collaborator

Overview

Add ErrorBoundaryGroup examples using sandpack.

PR Checklist

  • I did below actions if need
  1. I read the Contributing Guide
  2. I added documents and tests.

@kangju2000 kangju2000 self-assigned this Jun 28, 2024
Copy link

vercel bot commented Jun 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
suspensive.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2024 7:30am
v1.suspensive.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2024 7:30am
visualization.suspensive.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2024 7:30am

Copy link

changeset-bot bot commented Jun 28, 2024

⚠️ No Changeset found

Latest commit: 8b02ac9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codspeed-hq bot commented Jun 28, 2024

CodSpeed Performance Report

Merging #1002 will create unknown performance changes

Comparing add-error-boundary-group-examples (8b02ac9) with main (1771317)

Summary

⚠️ No benchmarks were detected in both the base of the PR and the PR.

@@ -24,7 +24,7 @@ export default function App() {
},
},
dependencies: {
'@tanstack/react-query': '^4.0.0',
'@tanstack/react-query': '^4',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manudeli #995 (comment)

I'm curious if all the features of Suspensive are intended for TanStack Query version 4. 🤔
Are there any features in Suspensive that only work with TanStack Query version 5?

Copy link
Member

@manudeli manudeli Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if all the features of Suspensive are intended for TanStack Query version 4. 🤔

Yes! but we support @tanstack/react-query@5 too at once by @suspensive/react-query's postinstall script made by @gwansikk. Check these Pull Request out to know how automatic targeting TanStack Query work please if you need.

When we install, @suspensive/react-query's postinstall script change target of @suspensive/react-query's dist/index.cjs like below

if @tanstack/react-query@4' is installed, @suspensive/react-query target @suspensive/react-query-4

// dist/index.js of @suspensive/react-query
import * from '@suspensive/react-query-4' // default

if @tanstack/react-query@5' is installed, @suspensive/react-query target @suspensive/react-query-5

// dist/index.js of @suspensive/react-query
import * from '@suspensive/react-query-5' // changed by postinstall script

Are there any features in Suspensive that only work with TanStack Query version 5?

We support interface like below with following TanStack Query's version

@suspensive/react-query with TanStack Query version 4

  • useSuspenseQuery
  • useSuspenseQueries
  • useSuspenseInfiniteQuery
  • queryOptions
  • SuspenseQuery
  • SuspenseQueries
  • SuspenseInfiniteQuery
  • QueryErrorBoundary

@suspensive/react-query with TanStack Query version 5

  • SuspenseQuery
  • SuspenseQueries
  • SuspenseInfiniteQuery
  • QueryErrorBoundary

Conclusion

In my opinion, We should provide Sandpack with TanStack Query v4 yet. but if you disagree it, suggestion also absolutely good for me! Suggest better solution if you have please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if you want to get help to know how to use cli of Suspensive React Query.
After you install @suspensive/react-query, you can use npx suspensive-react-query -h or npx srq-h made by @gwansikk in this Pull Request with commander.js

Copy link
Collaborator Author

@kangju2000 kangju2000 Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, We should provide Sandpack with TanStack Query v4 yet. but if you disagree it, suggestion also absolutely good for me! Suggest better solution if you have please.

The features we offer that are available in @tanstack/react-query@5 can also be used in @tanstack/react-query@4!
In that case, it seems we can keep the Sandpack dependency fixed at @tanstack/react-query@4 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, it seems we can keep the Sandpack dependency fixed at @tanstack/react-query@4 👍

That's right~!

@kangju2000 kangju2000 marked this pull request as ready for review June 28, 2024 07:31
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.33%. Comparing base (1771317) to head (8b02ac9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1002   +/-   ##
=======================================
  Coverage   87.33%   87.33%           
=======================================
  Files          38       38           
  Lines         450      450           
  Branches       98       99    +1     
=======================================
  Hits          393      393           
  Misses         54       54           
  Partials        3        3           
Components Coverage Δ
@suspensive/react 97.03% <ø> (ø)
@suspensive/react-query ∅ <ø> (∅)
@suspensive/react-query-4 0.00% <ø> (ø)
@suspensive/react-query-5 0.00% <ø> (ø)
@suspensive/react-await 100.00% <ø> (ø)
@suspensive/react-image 80.39% <ø> (ø)

Comment on lines +131 to +153
<ErrorBoundaryGroup>
<fieldset style={{ border: '1px solid red', padding: '10px' }}>
<legend>Outer ErrorBoundaryGroup</legend>
<ErrorBoundaryGroup.Consumer>
{(group) => <button onClick={group.reset}>Try again</button>}
</ErrorBoundaryGroup.Consumer>
<ErrorBoundary fallback={(props) => <>{props.error.message}</>}>
<ErrorAfter2s />
</ErrorBoundary>

<ErrorBoundaryGroup blockOutside>
<fieldset style={{ border: '1px solid blue', padding: '10px' }}>
<legend>Inner ErrorBoundaryGroup</legend>
<ErrorBoundaryGroup.Consumer>
{(group) => <button onClick={group.reset}>Try again</button>}
</ErrorBoundaryGroup.Consumer>
<ErrorBoundary fallback={(props) => <>{props.error.message}</>}>
<ErrorAfter2s />
</ErrorBoundary>
</fieldset>
</ErrorBoundaryGroup>
</fieldset>
</ErrorBoundaryGroup>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much better experience....!!! 🚀🚀🚀🚀🚀

image

@manudeli manudeli merged commit c515da6 into main Jun 28, 2024
16 checks passed
@manudeli manudeli deleted the add-error-boundary-group-examples branch June 28, 2024 08:38
manudeli pushed a commit that referenced this pull request Aug 3, 2024
…1002)

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

Add ErrorBoundaryGroup examples using sandpack.

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
manudeli pushed a commit that referenced this pull request Aug 3, 2024
…1002)

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

Add ErrorBoundaryGroup examples using sandpack.

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
manudeli pushed a commit that referenced this pull request Aug 3, 2024
…1002)

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

Add ErrorBoundaryGroup examples using sandpack.

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
manudeli pushed a commit that referenced this pull request Aug 3, 2024
…1002)

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

Add ErrorBoundaryGroup examples using sandpack.

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants