Closed brandoncordell closed 2 years ago
Could you please share the file structure of your project related to components and also the changes (as a diff) introduced after applying the template?
I was able to get the preview page working by starting from scratch and re-doing the configuration steps. I'm still having an issue with previews though. The server needs to be restarted for a preview to be picked up and when I change a Preview class ViewComponent can no longer find the preview and I need to restart the server. I'm not sure if that's a view_component issue or view_component-contrib.
For what it is worth, I had
config.view_component.preview_paths << Rails.root.join("/app/components")
and that caused it to search /app/components
only which obviously had no components.
I was able to get the preview page working by starting from scratch and re-doing the configuration steps. I'm still having an issue with previews though. The server needs to be restarted for a preview to be picked up and when I change a Preview class ViewComponent can no longer find the preview and I need to restart the server. I'm not sure if that's a view_component issue or view_component-contrib.
That is because the monkey patch runs load_previews if descendants.empty?
. Having to reload is definitely a PITA.
What did you do?
Installed
view_component-contrib
using the template and choosing the sidecar option. Creating some components that havecomponent_name > preview.rb
files.What did you expect to happen?
When going to
/rails/view_components
I expected to see a list of components that hadpreview.rb
files.What actually happened?
The page was blank.
Additional context
Environment
Ruby Version: 3.0.1
Framework Version (Rails, whatever): Rails 6.1.4
View Component Contrib Version: 0.1.0