joas8211 / payload-tenancy

Multi-tenancy plugin for Payload CMS
MIT License
122 stars 6 forks source link

Cannot update Global after creating #41

Closed 4external closed 1 month ago

4external commented 2 months ago

Hi!

I create new "blank" instance of payload with this plugin. Also create shared global "Settings".

In admin panel user can create shared global "Settings" record, successfully save it to DB(Mongo), but than user cannot change value of this global. In dev panel in browser I see that new values POST-ed to server, but server response old values.

4external commented 1 month ago

please correct me if I'm wrong, but if follow the code

  1. at first time when page with Global opened in admin createGlobalBeforeReadHook executed and create doc by initGlobal func in collection with initial values (here some bug with required fields without values)

  2. when user input new values and click Save button createGlobalBeforeChangeHook executed where getGlobal func return already existed doc (from step 1), so there is no branch for storing new values from data to existed doc.