tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.91k stars 89 forks source link

`Maximum call stack size exceeded` within `getNewRowId()` #192

Closed bywo closed 1 month ago

bywo commented 1 month ago

Describe the bug

I have a join table with thousands of rows. When I try to add a new row, I hit a Maximum call stack size exceeded, seemingly when tinybase is trying to generate a new Id.

Looking at the code, the problem seems to be the tail recursion in getNewRowId(), which tests ids from 0..n. I suspect converting this to a while loop would solve the problem.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

No response

Expected behavior

No response

Screenshots or Videos

No response

Platform

Additional context

No response

jamesgpearce commented 1 month ago

oh man, good catch

jamesgpearce commented 1 month ago

Fix is in v5.3.6 - go nuts!