matthewhudson / current-device

📱 The easiest way to write conditional CSS and/or JavaScript based on device operating system (iOS, Android, Blackberry, Windows, Firefox OS, MeeGo), orientation (Portrait vs. Landscape), and type (Tablet vs. Mobile).
https://matthewhudson.github.io/current-device/
MIT License
3.94k stars 587 forks source link

Cannot assign to read only property 'orientation' of object #319

Closed muhozi closed 2 years ago

muhozi commented 2 years ago

Describe the Nug

The package throws this error: Cannot assign to read only property 'orientation' of object

Screenshot 2022-08-04 at 00 10 07

How To Reproduce

Sometimes, This happens when you resize the browser window

Error Messages and Tracebacks

I traced the issue, it's being thrown at this line: https://github.com/matthewhudson/current-device/blob/f8f301b262dc1346b51b995bd922e39add70947e/src/index.js#L367

I checked the code, and it looks like the device object is not being frozen at any point.

muhozi commented 2 years ago

nvm, I found the issue. The issue was in our codebase!