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

Feature request: Extract AFX into separate component #46

Open
Sebobo opened this issue Mar 5, 2021 · 2 comments
Open

Feature request: Extract AFX into separate component #46

Sebobo opened this issue Mar 5, 2021 · 2 comments
Assignees

Comments

@Sebobo
Copy link

Sebobo commented Mar 5, 2021

Quite often I have the workflow of writing some AFX and the template gets bigger.

At some point now I want to select some lines and create a new component from that.

Workflow:

  1. Select lines and copy them
  2. Create a new protoype next to existing one which is somehow related to the same name
  3. Add a renderer with the copied content
  4. Replace the content in the original template with the new protoype

This is a workflow I also often use in PHP (extract into method).

Don't know how hard this, but would be very cool :)

@PRGfx
Copy link
Contributor

PRGfx commented Sep 15, 2024

I looked a bit into that this weekend, but the requirements aren't fully clear to me: in some cases I would have recurring instances of code where I want to keep the "children" content as is and only extract the surrounding tags, however there are many scenarios where it's not clear, which "children" I want to leave as is. Another thing are attributes that one might want to keep (e.g. move the class into the new component, but leave an href on the refactored part).

I experimented with a refactoring dialog with preview editors to see what we would get: I look for EEL statments in the selected tree and could imagine a table to deselect or rename the derived props.
However, this process is maybe a bit involved for everyday usage.
What do you think and how would you suggest props and "children" should be handled?

@Sebobo
Copy link
Author

Sebobo commented Sep 18, 2024

Thx for looking into this!
For the first version I wouldn't have expected anything fancy. Just a new prototype with the AFX part consisting of the previously selected template without any "smart" behaviour.
A second iteration could then already define all contained props.myProp and private.myVar in the head of the component, then manual work is anyway necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants