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

It is not possible to use render.Custom per component #112

Closed
yuriizinets opened this issue Feb 14, 2022 · 3 comments
Closed

It is not possible to use render.Custom per component #112

yuriizinets opened this issue Feb 14, 2022 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@yuriizinets
Copy link
Collaborator

Each render.Custom call overrides global context. With this approach it wouldn't be possible to define custom rendering on a component level.
As an option, we can store this in the state as internal, helpers.ComponentSerialize will remove it on state serialization.

@yuriizinets yuriizinets added bug Something isn't working good first issue Good for newcomers labels Feb 14, 2022
@yuriizinets yuriizinets added this to the v1.0 milestone Feb 14, 2022
@ghost
Copy link

ghost commented Mar 15, 2022

I'd like to take it. Any suggestions about where to start?

@yuriizinets
Copy link
Collaborator Author

@inthepanchine Sounds awesome! :)

Good start point for this journey is understanding how State and Context works. Both of them are instances of Store, but in case of Context it's re-used and passed in all definitions. State, otherwise, is unique for each defined component. You can see that behavior in core.Component.

So, what's general idea of render.Custom? With this functionality I would like to give developer an ability to define own custom rendering for page or component.

My current (wrong) implementation stores rendering function into the global context. We need to store that function into the core's state, with an internal: preffix. After changing that, you'll need to modify rendering handler here.

IMHO it would be a good idea also to handle this issue #85 in pair. They are related because render template function will be used to trigger render.Custom for components, like {{ render .MyComponent }}.

Temporary I don't have enough time now to give enough attention to the project, but feel free to contact me anytime! Email, Telegram, or just leave a comment here.

@yuriizinets
Copy link
Collaborator Author

@inthepanchine sorry, friend.
Managed to finish that on weekends :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant