Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fieldset): Support customProperties with sub-fields clashing with reserved words. #64

Merged
merged 8 commits into from
Feb 1, 2024

Conversation

joeynimu
Copy link
Collaborator

@joeynimu joeynimu commented Jan 26, 2024

The bug(what)
Passing the below jsfOption config to createHeadlessForm, we get an error;

createHeadlessForm(schema, {
  customProperties: {
    a_field_set: {
      name: { // 馃敟 name is a reserved keyword
        type: "hidden", 
      },
    },
  },
});

The solution

This PR updates the path used for getting customizing (jsfOptions) of the fields inside a fieldset. Before this was been read from the parent field (fieldset) but now we read them within the customProperties of the parent field

// BEFORE
{
...
customProperties: get(config, `customProperties.${name}`, {})
}

//AFTER
{
...
customProperties: get(config, `customProperties.${name}.customProperties`, {})
}

And so the failing jsfOption example above becomes;

// 馃憤 works as expected
createHeadlessForm(schema, {
  customProperties: {
    a_field_set: {
      customProperties: {
        name: {
          type: "hidden",
        },
      },
    },
  },
});

It also updates test cases to read the customisation from the new path.

@sandrina-p sandrina-p self-requested a review January 29, 2024 09:46
@joeynimu joeynimu changed the title fix: update fieldset customization fix(fieldset field customization): Update subfield(s) customProperties path Jan 29, 2024
@joeynimu joeynimu marked this pull request as ready for review January 29, 2024 16:39
@remotecom remotecom force-pushed the joe/fieldset-custom-properties branch from 8c5c56b to ca8be82 Compare January 29, 2024 18:08
package.json Outdated Show resolved Hide resolved
src/tests/createHeadlessForm.test.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@joeynimu joeynimu changed the title fix(fieldset field customization): Update subfield(s) customProperties path fix(fieldset): Support customProperties with sub-fields clashing with reserved words. Jan 30, 2024
@brennj
Copy link
Collaborator

brennj commented Jan 31, 2024

This is all good my side from testing it internally with Remote.

sandrina-p
sandrina-p previously approved these changes Feb 1, 2024
Copy link
Collaborator

@brennj brennj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets goo

@joeynimu joeynimu merged commit 8340cde into main Feb 1, 2024
3 checks passed
@joeynimu joeynimu deleted the joe/fieldset-custom-properties branch February 1, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants