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

Upcoming Release Changes #73

Merged
merged 2 commits into from
Jul 11, 2023
Merged

Upcoming Release Changes #73

merged 2 commits into from
Jul 11, 2023

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

Releases

@defer/client@1.7.0

Minor Changes

  • #66 b9973d5 Thanks @charlypoly! - Introducing @defer/client/next integration

    This release introduces two new helpers that makes Defer deeply integrated with NextJS:

    • asNextRoute(): used in combination of useDeferRoute() to trigger background functions from Client-side Components
    • useDeferRoute(): trigger and wait for the result of a background functions from Client-side Components

    Next API Routes

    import { asNextRoute } from "@defer/client/next";
    import createThumbnails from "../../defer/createThumbnails";
    
    const { GetHandler, PostHandler } = asNextRoute(createThumbnails);
    
    export const GET = GetHandler;
    export const POST = PostHandler;

    React client-side component

    import { useDeferRoute } from "@defer/client/next";
    import createThumbnails from "../../defer/createThumbnails";
    
    export function MyComp() {
      const { request, loading, result } = useDeferRoute(createThumbnails);
      return (
        <div>
          <span>Loading: {loading ? "Yes" : "No"}</span>
          <span>Result: {result ? JSON.stringify(result) : "--"}</span>
          <button onClick={() => request("")}>Call</button>
        </div>
      );
    }

@charlypoly charlypoly merged commit d4c002a into master Jul 11, 2023
4 checks passed
@charlypoly charlypoly deleted the changeset-release/master branch July 11, 2023 08:45
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.

None yet

1 participant