Skip to content

fix(datatrak): TUP-3193: Improve performance of survey submissions - #6885

Open
chris-bes wants to merge 19 commits into
devfrom
tup-3193-survey-submit-performance
Open

chris-bes wants to merge 19 commits into
devfrom
tup-3193-survey-submit-performance

Conversation

@chris-bes

Copy link
Copy Markdown
Contributor

Issue #:

Changes:

  • Example

Screenshots:


🦸 Review Hero

  • Run Review Hero
  • Auto-fix review suggestions
  • Auto-fix CI failures
  • Save suppressions

Comment on lines +44 to +45
const withExplicitId = answerDocuments.filter(document => document.id);
const withGeneratedId = answerDocuments.filter(document => !document.id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

import { partition } from 'es-toolkit';
Suggested change
const withExplicitId = answerDocuments.filter(document => document.id);
const withGeneratedId = answerDocuments.filter(document => !document.id);
const [withExplicitId, withGeneratedId] = partition(answerDocuments, document => document.id);

const answerRecords = [];
if (withExplicitId.length > 0) {
answerRecords.push(
...(await models.answer.createMany(withExplicitId, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This only ever gets run on one survey response at a time, right? Just making sure we avoid the stack overflow problem when trying to push too many elements at once

@chris-bes
chris-bes force-pushed the tup-3193-survey-submit-performance branch from 6fbd664 to 23ccd6a Compare August 5, 2026 23:33
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