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

Copy the config to each new component as it is created #2868

Merged
merged 2 commits into from Nov 4, 2022

Conversation

jcoyne
Copy link
Member

@jcoyne jcoyne commented Nov 3, 2022

Fixes #2867

@jrochkind
Copy link
Member

jrochkind commented Nov 3, 2022

I don't love the amount we are customizing ViewComponent, raising the risk of breakage with ViewComponent releases (which has happened on a couple minor releases of ViewComponent I think). I think it's taken more ongoing maintenance than anticipated to keep this working.

I also worry about performance implications once we start coping/creating data structures on every instantiation as here.

Is this thing for the ability to override templates from an engine with a template in local app? (A thing that the ViewComponent maintainers specifically recommend against?) I know @barmintor has been one of the proponents of this, but I think was open to reconsidering. Is it worth reconsidering?

Or is this for some other feature?

I would rather, and would propose, we just use ViewComponent as it's maintainers intend, instead of trying to patch it to work differently, resulting in periodic breakage and requiring this kind of ongoing maintenance. Keep it simple. Do we really need features other users of the popular ViewComponent package don't, do we need them enough to add this complexity?

@barmintor
Copy link
Contributor

This is a workaround for a documented issue in ViewComponent.

@barmintor
Copy link
Contributor

There have been two breaking changes w/ ViewComponent minor releases: One was the promotion of an experimental API (which we were using) to actual API (hurrah!); this one is a bug related to upstream changes: ViewComponent/view_component#1565

@cbeer
Copy link
Member

cbeer commented Nov 3, 2022

I wonder if we should use (or default to?) ViewComponent::Base.config.view_component_path instead of component_class.view_component_path? I'm not sure whether changing the config per-class is a feature?

@jcoyne
Copy link
Member Author

jcoyne commented Nov 4, 2022

Changed to @barmintor's implementation

@barmintor
Copy link
Contributor

@jcoyne can you add a pin to s.add_dependency "view_component", '~> 2.66' in the gemspec?

@barmintor
Copy link
Contributor

@cbeer that's a good question, too - though in this case, Base.config is empty, so we could approach as a separate issue?

Co-authored-by: Benjamin Armintor <armintor@gmail.com>
Copy link
Contributor

@barmintor barmintor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable workaround to to the upstream bug.

@jcoyne jcoyne merged commit 4010fa1 into main Nov 4, 2022
@jcoyne jcoyne deleted the view-componet-config branch November 4, 2022 15:11
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.

ViewComponent 2.75.0 breaks blacklight
4 participants