Skip to content

Fix memory crash when creating record in table view#16984

Merged
etiennejouan merged 2 commits intomainfrom
ej/fix-create-new-record
Jan 7, 2026
Merged

Fix memory crash when creating record in table view#16984
etiennejouan merged 2 commits intomainfrom
ej/fix-create-new-record

Conversation

@etiennejouan
Copy link
Copy Markdown
Contributor

@etiennejouan etiennejouan commented Jan 7, 2026

Bug Fixed
Creating a new record in the People table view caused a browser memory crash ("Paused before potential out of memory crash").
Root Cause
In useResetVirtualizationBecauseDataChanged.ts, when creating a record, a loop iterated from 0 to totalNumberOfRecordsToVirtualize (the total database count).
Fix Applied
Changed the loop to only iterate through indices from actually loaded pages

Fixes #16980

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts">

<violation number="1" location="packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts:102">
P2: `Math.min(...dataPagesLoaded)` will return `Infinity` and `Math.max` will return `-Infinity` when `dataPagesLoaded` is an empty array (which is the default value). Consider adding an early return when the array is empty to make the intent explicit and avoid relying on implicit behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 7, 2026

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:32909

This environment will automatically shut down when the PR is closed or after 5 hours.

@etiennejouan
Copy link
Copy Markdown
Contributor Author

After discussing it with @charlesBochet, we choose to remove individual row loading states resetting.
We accept the potential visual glitches (stale data or incorrect loading indicators) until the refetch completes.

Copy link
Copy Markdown
Contributor

@prastoin prastoin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed should also be reviewed by @lucasbordeau
We might wanna be iterating over the displayed data total count instead of none instead of all of them in db previously
Sounds good to me though !

@etiennejouan etiennejouan added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 81afc8b Jan 7, 2026
68 checks passed
@etiennejouan etiennejouan deleted the ej/fix-create-new-record branch January 7, 2026 14:17
@twenty-eng-sync
Copy link
Copy Markdown

Hey @etiennejouan! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

1 similar comment
@twenty-eng-sync
Copy link
Copy Markdown

Hey @etiennejouan! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

etiennejouan added a commit that referenced this pull request Jan 7, 2026
**Bug Fixed**
Creating a new record in the People table view caused a browser memory
crash ("Paused before potential out of memory crash").
**Root Cause**
In useResetVirtualizationBecauseDataChanged.ts, when creating a record,
a loop iterated from 0 to totalNumberOfRecordsToVirtualize (the total
database count).
**Fix Applied**
Changed the loop to only iterate through indices from actually loaded
pages

Fixes #16980
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace cannot create new People record

2 participants