Skip to content

Add examples/ folder for openapi-fetch #1310

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

Merged
merged 1 commit into from
Aug 19, 2023
Merged

Add examples/ folder for openapi-fetch #1310

merged 1 commit into from
Aug 19, 2023

Conversation

drwpow
Copy link
Contributor

@drwpow drwpow commented Aug 19, 2023

Changes

To prepare for some upcoming expanded docs for openapi-fetch examples (e.g. #1125), add an examples/ folder that moves the React Query example into, and shortens the docs. Overall this is a better experience seeing code in context.

How to Review

Docs-only change.

Checklist

  • Unit tests updated
  • docs/ updated (if necessary)
  • pnpm run update:examples run (only applicable for openapi-typescript)

@changeset-bot
Copy link

changeset-bot bot commented Aug 19, 2023

⚠️ No Changeset found

Latest commit: 7cac9ac

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

@@ -68,194 +68,24 @@ client.GET("/some-authenticated-url", {
});
```

## Caching
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may be slightly-controversial, but I removed the section on caching. I have a feeling like encouraging users to roll their own caching strategy in general is a bad idea. This should be replaced with more framework-specific examples that encourage good habits within your reactivity framework.

If a user is dedicated rolling their own client-side caching, then they probably aren’t the type to follow instructions 😄


If you need to work with promises, then just using `openapi-fetch` as-is will usually suffice. If you need promises + caching, then you’ll have to come up with a solution that fits your own custom usecase.

## React Query
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All this was just moved into packages/openapi-fetch/examples/react-query

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 19, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7cac9ac
Status: ✅  Deploy successful!
Preview URL: https://2922ff02.openapi-ts.pages.dev
Branch Preview URL: https://rq-example.openapi-ts.pages.dev

View logs

@drwpow drwpow merged commit 3b819e0 into main Aug 19, 2023
@drwpow drwpow deleted the rq-example branch August 19, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant