Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Ref gets lost during Suspense execution | GoodFirstPicks

Ref gets lost during Suspense execution

vercel/next.js 3 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Issue involves React Suspense behavior and ref handling during SSR.

AI Summary

The issue reports ref values being lost during Suspense execution in SSR mode, with a provided reproduction case. It requires understanding of both React's Suspense behavior and Next.js SSR implementation. The maintainer comment suggests this may be expected React behavior rather than a Next.js bug.

Issue Description

Link to the code that reproduces this issue

https://github.com/nirus/nextjs-ref-ssue

To Reproduce

  1. Clone the application
  2. Run the application is SSR debug mode in Vs-code (launch.json)
  3. Observe the console.log in terminal window

Current vs. Expected behavior

useModuleImportSuspense throws the promise and cause the SSR to suspend and refs loose the value on subsequent rendering when resolved.

Current Behaviour: HELLO THERE ---> false HELLO THERE ---> false ..(loop)

Expected Behaviour HELLO THERE ---> false HELLO THERE ---> true

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:25 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8110
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: 1.22.19
  pnpm: 8.11.0
Relevant Packages:
  next: 14.2.4 // Latest available version is detected (14.2.4).
  eslint-config-next: 14.2.4
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Lazy Loading, Performance

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

Similar bug on preact - https://github.com/preactjs/preact-ssr-prepass/issues/23

GitHub Labels

bugLazy LoadingPerformance

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • React behavior vs Next.js bug
  • potential architectural implications
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno