-
-
Notifications
You must be signed in to change notification settings - Fork 639
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 class components to functional components #4460
Comments
To all GSOC aspirants: https://community.plone.org/t/recommendations-for-gsoc-aspirants/16301/3 /cc @sudhanshu1309 |
@sneridagh what Plone version is this feature planned for? |
@tisto This is an ongoing effort. Tisha worked on this during her GSOC. The reach was too broad, so we had to cut it down. This can be presented again in the next GSOC for continuation of the work. The ones reviewed and merged (during 17 alpha phase) were released in Volto 17. In the meanwhile, there are still some PRs opened (one per component). These are merged in alpha stages, because they are considered breaking. AFAIK, the project is stalled right now. |
PLIP (Plone Improvement Proposal)
Responsible Persons
Proposer: Víctor Fernández de Alba (@sneridagh)
Seconder:
Abstract
Refactor all the possible components in Volto that still are class-based components. Convert them to functional components, whenever possible.
Motivation
Volto still have a number of core components that are React class-based components. This prevents the use of hooks in them, and newest DX on them.
The idea is also while moving to them, use hooks to abstract the functionality present in Redux and in data fetching so in a near future we can easily switch using the hooks to use other props provider.
Assumptions
No assumptions.
Proposal & Implementation
Refactor should be done carefully and providing Cypress (acceptance) tests where they do not exist. The lifecycle of the components should be preserved while watching out for edge cases and UX problems.
Deliverables
It should be delivered all at once, as a major breaking change. Ideally, we won't change the contract of any of the components, so no new props passed down, no return anything to the tree that we were not returning before, unless it's justified.
If the contract has to be broken, then it must be properly documented and exposed in the upgrade guide.
The refactored components. Here there is a preliminary list, subject to change:
src/components/manage/Widgets/FormFieldWrapper.jsx
Complex / Optional:
Risks
The lifecycle of a component could easily be changed if the refactor is not done carefully and giving attention to details, that's why we should provide acceptance tests and heavy QA should be done while doing it.
Participants
This PLIP was part of the GSOC 2023 project assigned to Tisha Soumya (@Tishasoumya-02). Its scope proved to be too large for a single GSoC effort, and some components were left unfactored. She is available to review or approve pull requests for this PLIP.
The above list may be out of date. Do not duplicate effort. Search the issues and pull requests for existing work.
Read and follow First-time contributors, especially Things not to do, Contributing to Plone, and Contributing to Volto.
If your instructor gave you a class assignment to work on Volto or open source software, or you otherwise have no commitment to use and develop Plone or Volto, then you are not a contributor.
Pull requests that fail to comply with these contributing guidelines may be closed without explanation.
The text was updated successfully, but these errors were encountered: