8000 [playground] handle when transformOutput is null by henryqdineen · Pull Request #34724 · facebook/react · GitHub
[go: up one dir, main page]

Skip to content

Conversation

henryqdineen
Copy link
Contributor

Summary

The React Compiler Playground was crashing for me with a error that said "Application error: a client-side exception has occurred while loading playground.react.dev". I could only fix it by clearing the browser data

Screenshot 2025-10-03 at 3 26 20 PM

Console error:

Uncaught TypeError: Cannot read properties of undefined (reading 'code')
    at R (2718.2ef44c120f1f0fb2.js:1:2240553)
    at 2718.2ef44c120f1f0fb2.js:1:2242468
    at V (2718.2ef44c120f1f0fb2.js:1:2242518)

Problematic source code:

import { UIHeader } from 'somewhere';

const Header = ({
  breadcrumbs = <div className="foo" />, 
}) => {
  return (
    <UIHeader breadcrumbs={breadcrumbs}/>      
  );
};

I tracked this down to a bug that I think should be caught by TypeScript since CompilerTransformOutput['transformOutput'] is non-nullable. My fix was to move the return statements into the try and catch blocks. I had something slightly different in an initial fix but I was confused by otherErrors and hasErrors().

How did you test this change?

Tested locally. Screen shot attached.

Screenshot 2025-10-03 at 3 23 31 PM

@meta-cla meta-cla bot added the CLA Signed label Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0