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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core/strapi): move components to registry #16273

Closed
wants to merge 7 commits into from
Closed

refactor(core/strapi): move components to registry #16273

wants to merge 7 commits into from

Conversation

iamandrewluca
Copy link
Contributor

@iamandrewluca iamandrewluca commented Apr 1, 2023

What does it do?

Move the loading and fetching of components through a registry

Why is it needed?

For future feature that will allow to load components from plugins

How to test it?

Follow the default instructions how to run Strapi locally, and check components in content builder

Related issue(s)/PR(s)

PR (Draft): #16132

PR (Closed): #12965
PR (Closed): #9104
Issue (Closed): #7640
Feature request: feedback.strapi.io/developer-experience/p/components-inside-of-plugins

@iamandrewluca iamandrewluca changed the title refactor(core): move components to registry refactor(core/strapi): move components to registry Apr 1, 2023
const { validateComponentDefinition } = require('./validator');

const createComponent = (definition = {}) => {
validateComponentDefinition(definition);
const createComponent = (uid, definition = {}) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method was dead code previously

}
};

const componentsRegistry = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This registry was copied from content-types and adjusted comments and variables.

* @param {string} uid
* @param {(component: Object) => Object} extendFn
*/
extend(cUID, extendFn) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the registry need to implement any interface? Can these unused methods get deleted?

@christiancp100 christiancp100 added source: core:strapi Source is core/strapi package pr: enhancement This PR adds or updates some part of the codebase or features labels Apr 17, 2023
@iamandrewluca
Copy link
Contributor Author

iamandrewluca commented Apr 19, 2023

What else can I do to move this PR forward and make it better? 👀

@iamandrewluca
Copy link
Contributor Author

Any plans for this in the near future?
Should I keep this PR up to date or can I close it? 👀

@alexandrebodin
Copy link
Member

Hey @iamandrewluca I would like to review it as we plan to move components to registries in v5. I'm just worried about unexpected breaking changes if we do it now. I'll probably up it myself no worries :) And Thank you for contribute !

@iamandrewluca
Copy link
Contributor Author

iamandrewluca commented Jun 21, 2023

Thanks for the response @alexandrebodin. Then I'll keep it open.

@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/custom-plugin-component-and-content-type-creation-by-startup/32037/2

@alexandrebodin
Copy link
Member

Hey @iamandrewluca I'm going to go ahead and close this PR for now. We are starting to work on v5 and won't be adding such a big change in v5. FYI we already created a registry for compos in v5 even if we are not ready yet to allow components coming from plugins this is a 1st step into that direction. Thank you for opening the path for it!

@iamandrewluca
Copy link
Contributor Author

iamandrewluca commented Oct 30, 2023

Hey, @alexandrebodin glad to hear that some movement is done in that direction!
I've also closed this PR as it may not be relevant anymore #16132

Thanks!

@iamandrewluca iamandrewluca deleted the move-components-to-registry branch October 30, 2023 13:06
@alexandrebodin
Copy link
Member

Thanks ! If you are interested in working on this for v5 let me know we can give you some pointers :)

@iamandrewluca
Copy link
Contributor Author

Will see in the future.
I started these pull requests while I was actively working on a project that is using Strapi.
Now I'm less active in that project. Maybe in the near feature, we may have another Strapi project and I may be interested again in this feature.

@Eggwise
Copy link
Contributor

Eggwise commented Jan 3, 2024

Will this be implemented ? now we cannot create plugins with components

@iamandrewluca
Copy link
Contributor Author

iamandrewluca commented Jan 3, 2024

From what I saw in the repo, in the v5 they already are preparing the ground for that. Components were moved to the registry pattern in v5, and should be easier to move on with implementing plugin components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: enhancement This PR adds or updates some part of the codebase or features source: core:strapi Source is core/strapi package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants