Skip to content

PRO-8256: allow createWidgetOperations to be filtered based on a list of widget types - #5057

Merged
boutell merged 1 commit into
mainfrom
pro-8256
Sep 5, 2025
Merged

PRO-8256: allow createWidgetOperations to be filtered based on a list of widget types#5057
boutell merged 1 commit into
mainfrom
pro-8256

Conversation

@boutell

@boutell boutell commented Sep 3, 2025

Copy link
Copy Markdown
Member

... So we don't offer "insert section" if none of the widget types allowed in this area are permitted to be the basis for a section.

This does NOT mean you can never hit "insert section" and find an empty list. That would require an expensive API call, so it's not worth it.

@linear

linear Bot commented Sep 3, 2025

Copy link
Copy Markdown

// interface regardless of whether `options.widgets` or `options.groups`
// was used.
getWidgets(options) {
// Keep in sync with client-side implementation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not a new issue, but I avoided further duplication within the client side.

Right now we have some ESM/commonjs issues that prevent us from sharing code as well as I'd like between front and back end.

@@ -0,0 +1,14 @@
// Requires an area field's .options property

export default function getWidgets(options) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I didn't strictly have to factor this out today, but in the long run I'd like to have one implementation, so this is the right direction.

origin: null,
preview: true
},
handlers(self) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Registering the widget operations late prevents the section template library from altering them cleanly if some modules are configured before and some after, which is likely because of our support for modules.js files with nestedModuleSubdirs. Yes this took me a while to figure out.

});
},

composeWidgetOperations() {

@boutell boutell Sep 3, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no actual changes to the logic here.

@stuartromanek
stuartromanek requested review from ETLaurent and myovchev and removed request for stuartromanek September 4, 2025 13:51
@stuartromanek

Copy link
Copy Markdown
Member

changing reviewers to @myovchev and/or @ETLaurent , as I believe they have been dealing with this code more recently.

@boutell

boutell commented Sep 4, 2025 via email

Copy link
Copy Markdown
Member Author

@boutell
boutell merged commit e4eea18 into main Sep 5, 2025
6 checks passed
@boutell
boutell deleted the pro-8256 branch September 5, 2025 13:21
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.

3 participants