What is causing the warning 'Removing intrinsics.%ArrayPrototype%.toReversed' in React?
Asked Answered
B

2

101

I am getting following warning on first load of my App.

lockdown-install.js:1 Removing intrinsics.%ArrayPrototype%.toReversed
intrinsics.%ArrayPrototype%.@@unscopables.toSpliced
intrinsics.%ArrayPrototype%.@@unscopables.toSorted

I really have no idea what this is about, so there's nothing that I have previously tried.

I went into the node_modules to try and find something related to it... been searching on the internet and even chatGPT but the information that I found is vague.

Barcelona answered 2/6, 2023 at 20:3 Comment(0)
W
187

I randomly started getting this in my project right around the time you made this post which was odd.

Do you have Metamask installed as a browser extension? I disabled the extension and the warnings went away.

I found this post: https://github.com/MetaMask/eth-phishing-detect/issues/11900 Which potentially suggests that something in our projects are triggering metamasks anti-phishing feature somehow? Not quite sure, but disabling the extension removed the warnings and confirmed it wasn't something in my app directly.

Wamsley answered 2/6, 2023 at 20:46 Comment(5)
If it is the case that the site is triggering an anti phishing program then maybe there is something else to look at.Juliettajuliette
Metamask. Did not delete, though, just turned it off and the errors went away. TY!Masson
Also applies to Angular.Spavined
Dude, your a life saver....Drillstock
This works in many web apps, in my ase I use Bootstrap and php and turning off the metamask works like a charm! Thank you!Johansen
T
23

Warning is coming from MetaMask Chrome Extension, not your React app.

It seems that MetaMask checks native prototypes in its environment to see if they have been mutated or tampered with, as a security measure.

With ES2023, some native prototypes have gained new methods, such as toSorted, toReversed, etc. It looks like MetaMask is not updated to know about these, so it thinks the native prototypes are mutated or changed. Basically, MetaMask just removes these "unknown" methods from the prototypes and then logs about it on the console.

If you go and inspect your MetaMask extension popup and write [].toSorted in the console, you will get undefined because MetaMask has removed them since it doesn't recognize them.

You don't have to do anything, you can just ignore them for now until MetaMask updates.

Talton answered 14/6, 2023 at 11:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.