kirillzyusko / react-native-bundle-splitter

HOC for lazy components loading
https://kirillzyusko.github.io/react-native-bundle-splitter/
MIT License
428 stars 22 forks source link

Fix: Map context loosing #68

Closed IvanIhnatsiuk closed 4 months ago

IvanIhnatsiuk commented 4 months ago

Description

The problem lies in two functions isCached and getComponentFromCache. It seems that in the optimised.tsx file we somehow lose the Map context and I get this error: TypeError Non-Map object called on Map.prototype.has. So, I just added arrow functions and it fixed the problem 🙂

Screenshots

Before:

https://github.com/user-attachments/assets/7ad7bb2f-90f3-44b1-97c9-15bfeb87080b

After:

https://github.com/user-attachments/assets/50fd14cc-4e9d-41a0-a861-e952888c5aa0