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
refactor(core/strapi): move components to registry #16273
Conversation
const { validateComponentDefinition } = require('./validator'); | ||
|
||
const createComponent = (definition = {}) => { | ||
validateComponentDefinition(definition); | ||
const createComponent = (uid, definition = {}) => { |
There was a problem hiding this comment.
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 = () => { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
What else can I do to move this PR forward and make it better? 👀 |
Any plans for this in the near future? |
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 ! |
Thanks for the response @alexandrebodin. Then I'll keep it open. |
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 |
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! |
Hey, @alexandrebodin glad to hear that some movement is done in that direction! Thanks! |
Thanks ! If you are interested in working on this for v5 let me know we can give you some pointers :) |
Will see in the future. |
Will this be implemented ? now we cannot create plugins with components |
From what I saw in the repo, in the |
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