Skip to content

Runtime error: cache imported from 'react' instead of 'react/cache' in React 19 #3071

@sykp241095

Description

@sykp241095

Describe the bug

In React 19, the cache function has been moved from the main 'react' package to 'react/cache'. The current code imports cache from 'react', which will cause a runtime error.

Files affected

  1. apps/web/app/ai-home-data.ts (line 2)
  2. apps/web/app/analyze/(org)/[owner]/fetchOwner.tsx (line 4)

To Reproduce

Run the application with React 19 - the import will fail at runtime because cache is not exported from 'react' anymore.

Expected behavior

Import cache from 'react/cache' instead of 'react'.

Fix

Change:

import { cache } from 'react';

To:

import { cache } from 'react/cache';

Environment

  • React: 19.2.4
  • Next.js: (current version)

Additional context

This is a breaking change in React 19. See React 19 documentation for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions