realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Maximum call stack size exceeded rendering three-level data structure in FlatList using @realm/react v0.4.3

Open myou11 opened this issue 1 year ago • 6 comments

How frequently does the bug occur?

Always

Description

Hi, I am having trouble with my app crashing due to rendering too many Realm items in a FlatList. I have a three level deep nested data structure similar to what can be seen in this repo. I modified the project from this previous related issue. In this previous issue, the PR that fixed it made some changes to cachedObject.ts. I am running into an issue with this file in particular. In my internal company project, my app crashes after adding around 60-80 items depending on the device I test on. Here is a picture of the stacktrace. You can see the "Maximum call stack size exceeded while running cachedObjectHandler.get. realmUNITO-UNDERSCORE!call!UNITO-UNDERSCORE!stack!UNITO-UNDERSCORE!size!UNITO-UNDERSCORE!exceeded!UNITO-UNDERSCORE!flatlist! Unfortunately, I can't reproduce the issue in the repo I linked earlier, but the repo does show a similar three-level data structure (Task ~~> Subtasks~~ > SubSubtasks) to my project. I am able to trigger the crash always by opening the app and adding 60-80 items. The interesting thing is that when I re-open the app, my previous 60-80 items I added before were there and it does not crash until I add another set of 60-80 items in that "session". I downgraded my app to a version I had previously, before I upgraded my @realm/react from 0.4.1 to 0.4.3. The 0.4.1 version does not encounter this issue. I was able to add 100+ items and no crash. I reinstalled the 0.4.3 version and got the crash like stated earlier. I'm not sure exactly how to get around this issue other than downgrading to 0.4.1, but I would like the fixes provided by 0.4.3.

Can you please help me take a look into this issue please?

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

[email protected]

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 16

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

myou11 avatar Apr 14 '23 20:04 myou11