Unexpected type conversion of react context class to object type in NextPage #54562
Closed
1 task done
Labels
bug
Issue was opened via the bug report template.
Lazy Loading
Related to Next.js Lazy Loading (e.g., `next/dynamic` or `React.lazy`).
stale
The issue has not seen recent activity.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 21.6.0: Thu Jun 8 23:56:13 PDT 2023; root:xnu-8020.240.18.701.6~1/RELEASE_ARM64_T6000 Binaries: Node: 18.16.1 npm: 9.5.1 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 13.4.19 eslint-config-next: 13.4.19 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
Dynamic imports (next/dynamic)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/clober-dex/coupon.finance/blob/fix/class-type-context/pages/deposit/%5Bsymbol%5D.tsx#L53
To Reproduce
Describe the Bug
In the context of a Next.js application, an unexpected behavior has been observed where the class type defined for a React context undergoes a conversion to an object type specifically when accessing the NextPage directly. The behavior is inconsistent with the expected behavior when the application starts from the MyApp component.
Expected Behavior
The class type assigned to the React context should remain consistent and unchanged, regardless of whether the application is started from the MyApp component or if the user navigates directly to the NextPage component.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: