Skip to content

[6.x] Avoid indexing form submissions when there's no partial submission - #16161

Merged
jasonvarga merged 1 commit into
6.xfrom
skip-empty-submission-lookup
Dec 4, 2026
Merged

jasonvarga merged 1 commit into
6.xfrom
skip-empty-submission-lookup

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where rendering a form with a cold Stache would index every form submission, even though the session has no partial submission.

This was happening because the form tag, the JS drivers and FormController all call $form->submission($id) on every render. Even when $id is null, FormSubmission::find(null) still indexes the whole submissions store.

This PR fixes it by returning early from Form::submission() when there's no id.

With a 25-field form and 5,000 submissions, a cold-Stache {{ form:create }} render went from indexing all 5,000 submissions (233 MB peak) to indexing none (4.8 MB peak).

This only covers the first half of the issue. The submission memory fix is being handled separately.

Related: #16159

Amp thread: https://ampcode.com/threads/T-4b1b1e19-ffb7-4941-ae76-a71e982542f2

`Form::submission()` now returns early without an id, so rendering a form no longer indexes every submission.

Amp-Thread-ID: https://ampcode.com/threads/T-4b1b1e19-ffb7-4941-ae76-a71e982542f2
Co-authored-by: Amp <amp@ampcode.com>
@jasonvarga
jasonvarga merged commit f042dd5 into 6.x Dec 4, 2026
64 checks passed
@jasonvarga
jasonvarga deleted the skip-empty-submission-lookup branch December 4, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants