Prisma not creating entries in the given order

I have the following trpc prisma code given below. When "module" have the optional "image" field filled it will be created after all the empty ones even though the request has them in an array where they are ordered. Any idea on how to fix it? Sorry for the long code

Output:
Got modules as: [ '<p>1</p>', '<p>2</p>', '<p>3</p>', '<p>4</p>' ]
Created modules as: [ '<p>2</p>', '<p>3</p>', '<p>4</p>', '<p>1</p>' ]

Code:
beautify-picture.webp
Was this page helpful?