payload icon indicating copy to clipboard operation
payload copied to clipboard

fix: do not modify original collections array/obj when sanitizing config

Open gnovotny opened this issue 2 years ago • 2 comments

Description

Fixes:

  • When instantiating payload more than once, fixes the DuplicateCollection error caused by adding the preferences and migrations collections to the original config collections object.

Explanation:

  • Why instantiate payload more than once? Because I'm using a reduced payload configuration for the local API (dev server performance, customized @payloadcms/db-postgres package). Why is this still occurring when using multiple configurations? Because my collections object is shared between configurations.

  • [x] I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x] Existing test suite passes locally with my changes

gnovotny avatar Apr 13 '24 16:04 gnovotny

I don't think that this is the only thing that is preventing Payload from being instantiated more than once. I'm pretty sure there will be other issues to getting this working.

Have you tried in your own project with this change?

DanRibbens avatar Apr 21 '24 03:04 DanRibbens