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

Next.js 13 No SSR Support. #1743

Closed
4 tasks done
Yefee8 opened this issue Sep 17, 2023 · 1 comment
Closed
4 tasks done

Next.js 13 No SSR Support. #1743

Yefee8 opened this issue Sep 17, 2023 · 1 comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser

Comments

@Yefee8
Copy link

Yefee8 commented Sep 17, 2023

Prerequisites

Environment check

  • I'm using the latest msw version
  • I'm using Node.js version 14 or higher

Browsers

Chromium (Chrome, Brave, etc.)

Reproduction repository

privaterepo

Reproduction steps

yarn test

Current behavior

In Next.js 13, We can't load mocks in SSR.
There's just one way to load mocks but that's just for CSR.

example:

"use client"

import { useState } from 'react';

export default function ChildrenFunction({ children }: any) {

    const [isLoaded, setIsLoaded] = useState(false);

    import('../../mocks').then(({ setupMocks }) => {
        setupMocks().then(() => {
            setIsLoaded(true)
        })
    });

    return (
        <main>
            {
                isLoaded ? children : <></>
            }
        </main>
    )
}

(I'm using this component in layout.tsx)

Expected behavior

Loading Mocks In SSR with Next.js 13.

@Yefee8 Yefee8 added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser labels Sep 17, 2023
@kettanaito
Copy link
Member

Hi, @Yefee8. Thanks for raising this. We don't currently have support for Next 13, and you should follow the progress on that support in #1644. Until it lands, we cannot accept issues around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:browser Related to MSW running in a browser
Projects
None yet
Development

No branches or pull requests

2 participants