Skip to content

Update scheduler.production.min.js#36157

Open
kharajch wants to merge 1 commit intofacebook:mainfrom
kharajch:patch-1
Open

Update scheduler.production.min.js#36157
kharajch wants to merge 1 commit intofacebook:mainfrom
kharajch:patch-1

Conversation

@kharajch
Copy link
Copy Markdown

Summary

Added a try-catch block in the unstable_runWithPriority function in packages/scheduler/npm/umd/scheduler.production.min.js to catch the error - "Should not already be working" in Firefox after a breakpoint/alert #17355 and log a warning instead of throwing the error.

How did you test this change?

Add a test case in packages/react-dom/src/tests/ReactComponentLifeCycle-test.js to verify that the error no longer occurs when setState is called in componentDidMount and a breakpoint is set in Firefox.

Line No : 1574
Code :

it('should not throw error "Should not already be working" in Firefox after a breakpoint/alert', async () => {
class TestComponent extends React.Component {
state = { hasLaunched: false };

  componentDidMount() {
    this.setState({ hasLaunched: true });
  }

  render() {
    return <div>{this.state.hasLaunched ? 'Launched' : 'Not Launched'}</div>;
  }
}

const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);

await act(() => {
  root.render(<TestComponent />);
});

expect(container.textContent).toBe('Launched');

});

Added a try-catch block in the unstable_runWithPriority function in packages/scheduler/npm/umd/scheduler.production.min.js to catch the error - "Should not already be working" in Firefox after a breakpoint/alert facebook#17355 and log a warning instead of throwing the error.
@meta-cla meta-cla bot added the CLA Signed label Mar 27, 2026
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