This is the same fix from https://github.com/vercel/next.js/pull/15729 - Adding it in a new PR as I can't update the current one. Closes #15729 Fixes #15676