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(readme): update sequenced api example #70

Merged
merged 3 commits into from
Feb 24, 2023
Merged

Conversation

code-forger
Copy link
Member

Motivation and Context

The sequenced api example resulted in multiple calls from the 'second' api in the sequence, these api calls were malformed, as the input required from the 'first' api in the sequence was not available yet.

How Has This Been Tested?

Locally in a module

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • My changes are in sync with the code style of this project.
  • There aren't any other open Pull Requests for the same issue/update.
  • These changes should be applied to a maintenance branch.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using Fetchye?

Improved example on how to call sequenced api calls

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 22, 2023

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 6b944f0:

Sandbox Source
quick-install Configuration
fetchye-provider-install Configuration
fetchye-redux-provider-install Configuration
nextjs-fetchye-ssr Configuration

```jsx
import React from 'react';
import { useFetchye } from 'fetchye';

const MyFavoriteBook = () => {
const { isLoading: loadingProfile, data: profile } = useFetchye('http://example.com/api/profile');
const { isLoading: loadingBook, data: favoriteBook } = useFetchye(() => `http://example.com/api/books/${profile.body.favoriteBookId}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

this example relies on an error being thrown Cannot read properties of undefined . I think the defer example will be easier to understand.

Might still be worth having an example of useFetchye receiving a function instead of a string

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to include original style example

README.md Outdated Show resolved Hide resolved
Co-authored-by: Jonny Adshead <JAdshead@users.noreply.github.com>
@JAdshead JAdshead merged commit 8fa57c1 into main Feb 24, 2023
@JAdshead JAdshead deleted the docs/sequenced-api-calls branch February 24, 2023 16:04
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