Files
twenty/packages/twenty-front
Charles Bochet 14d8105f22 fix(front): remove runtime default-view creation fallback (#21652)
## Problem

`useCreateDefaultViewForObject` was a temporary runtime fallback that
created a view + one view field per field (each with a fresh `v4()` id)
whenever `RecordIndexLoadBaseOnContextStoreEffect` found no view for the
current view id. Because the created view got a fresh id that never
matched the requested `contextStoreCurrentViewId`, the next load missed
again and re-created another duplicate — leaking `core.view` /
`core.viewField` rows without bound (notably during the 2.13.0
cache-first bootstrap window).

#21592 made the fallback idempotent as a stop-gap, but the mechanism is
no longer needed at all: standard/index views are created server-side at
object creation and during standard app installation, so the client
never needs to mint them.

## Change

Remove the fallback entirely:
- Delete `useCreateDefaultViewForObject`.
- In `RecordIndexLoadBaseOnContextStoreEffect`, when no view resolves
for the current id, do nothing and let the loaded views settle (the
effect re-runs once the view is present and loads it).

## Note

This removes the leak at the source for any client running the new
bundle. Clients still on old cached JS will keep creating duplicates
until they reload; the already-leaked rows are being cleaned up
separately via SQL.

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/21652?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
2026-06-16 11:08:48 +02:00
..

Run yarn dev while server running on port 3000