Skip to content

[Bug]: makeStyles uses deprecated event "unload" #35750

@MLoughry

Description

@MLoughry

Package

react

Package version

8.125.4

React version

N/A

Environment

N/A

Current Behavior

makeStyles uses the deprecated window event "unload"

Expected Behavior

Per MDN documentation, the code should instead use either the visibilitychange or pagehide events.

Given that this code looks related to cache cleanup, I'm unclear of the implications if a window were re-used after the above events fired. I'm also not sure of the scale of cache size and whether either the cache or cleanup are needed.

I'm happy to make any change under the advice of code owners.

Reproduction

N/A

Steps to reproduce

Call makeStyles

Are you reporting an Accessibility issue?

None

Suggested severity

Low - Has or doesn't need a workaround

Products/sites affected

Outlook - our reporting endpoint has a significant number of deprecation reports for this issue, drowning out other deprecation reports.

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions