payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
24.94k stars 1.59k forks source link

Fix for form-builder bug not yet published to npm #8849

Open didierrothuizen opened 1 week ago

didierrothuizen commented 1 week ago

Link to reproduction

No response

Describe the Bug

About half a year ago, there was a fix for the form builder that correctly extended all hook overrides that are applied to the formSubmissions collection. See this commit Unfortunately, this fix has never been published to npm.

Can someone release and publish a version 1.2.3? (in package.json)

To Reproduce

Install latest version of the form builder plugin Inspect files in the node_modules folder note that in node_modules/@payloadcms/plugin-form-builder/dist/collections/FormSubmissions/index.js the file mismatches with how the source code is.

The code in the installed index.js:

        hooks: {
            beforeChange: [
                (data)=>(0, _createCharge.default)(data, formConfig),
                (data)=>(0, _sendEmail.default)(data, formConfig),
                ...formConfig?.formSubmissionOverrides?.hooks?.beforeChange || []
            ],
            ...formConfig?.formSubmissionOverrides?.hooks || {}
        }

The source code:

    hooks: {
      ...(formConfig?.formSubmissionOverrides?.hooks || {}),
      beforeChange: [
        (data) => createCharge(data, formConfig),
        (data) => sendEmail(data, formConfig),
        ...(formConfig?.formSubmissionOverrides?.hooks?.beforeChange || []),
      ],
    },

Payload Version

2.30.3

Adapters and Plugins

form-builder

DanRibbens commented 1 week ago

Thanks for bringing this to our attention! We'll make sure it is published.