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

[Docs]Update document for changing view_component_path #1870

Merged

Conversation

hachi8833
Copy link
Contributor

@hachi8833 hachi8833 commented Oct 14, 2023

What are you trying to accomplish?

I'm trying to update the document so that users can change the view_component_path.

What approach did you choose and why?

I got stuck when I tried to introduce ViewComponent to Rails 7.1 app because changing just config.view_component.view_component_path did not work.

Finally I found that config.eager_load_paths should also be changed with the same path to get this change work.

I checked the fact with the newly generated Rails 7.1/7.0/6.1 apps.

@hachi8833 hachi8833 requested a review from Spone as a code owner October 14, 2023 04:46
@Spone
Copy link
Collaborator

Spone commented Oct 14, 2023

Thanks for reporting this! I'm wondering if we can inject the view_component_path into the eager_load_paths when needed, so the users don't need to do it themselves.

@hachi8833
Copy link
Contributor Author

hachi8833 commented Oct 15, 2023

Sounds a better idea!
If the auto-injection is supported, the PR can be closed instead.

@Spone
Copy link
Collaborator

Spone commented Oct 15, 2023

Would you like to try it and open a PR for the changes?

@hachi8833
Copy link
Contributor Author

hachi8833 commented Oct 16, 2023

After that I change my mind: just adding the documents might be safer because the eager-loading config is explicit and we don't need to change the current code. How about this?

I'm also a bit worried about changing the code might affect some patches to ViewComponent such as following:

https://github.com/palkan/view_component-contrib

@reeganviljoen
Copy link
Collaborator

Maybe we can get the view_component_contrib maintaners to join this discussion, they may be keen to add this to their lib too

@reeganviljoen
Copy link
Collaborator

@Spone @camertron Since this could be a breaking change I suggest that maybe we add this to v4 checklist

@camertron
Copy link
Contributor

What specifically would be the danger in automatically adding the view_component_path to the list of eager load paths? Seems like a pretty safe thing to do, unless I'm really missing something?

@reeganviljoen
Copy link
Collaborator

From what I understand their is a bit of concern that existing community patches may break but on further thought we can't gurantee the stability of other libraries that patch vc

@camertron
Copy link
Contributor

@reeganviljoen right yeah, I'm curious about the specific issues community patches would have if ViewComponent were to automatically append to the set of Rails eager load paths. It's possible we need to do some investigation here.

docs/guide/generators.md Outdated Show resolved Hide resolved
@camertron
Copy link
Contributor

Going to merge this for now since it's just a documentation change 👍

@camertron camertron merged commit f087bcf into ViewComponent:main Oct 18, 2023
@hachi8833 hachi8833 deleted the update_doc_for_view_component_path branch November 20, 2023 09:45
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
…#1870)

* Update document for changing view_component_path

* Update docs/CHANGELOG.md

* Update docs/guide/generators.md

---------

Co-authored-by: Cameron Dutro <[email protected]>
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
…#1870)

* Update document for changing view_component_path

* Update docs/CHANGELOG.md

* Update docs/guide/generators.md

---------

Co-authored-by: Cameron Dutro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants