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

Bridgetown fails to build against view_component 3.9 #3145

Open
davidrapson opened this issue Jan 8, 2024 · 3 comments · May be fixed by #3362
Open

Bridgetown fails to build against view_component 3.9 #3145

davidrapson opened this issue Jan 8, 2024 · 3 comments · May be fixed by #3362
Labels
bug Something isn't working

Comments

@davidrapson
Copy link
Contributor

davidrapson commented Jan 8, 2024

The bridgetown project fails to build when updated to view_component 3.9. We should investigate the cause and potentially create a reduced test case to confirm if the issue can be replicated using a fresh bridgetown install.

Related issue: bridgetownrb/bridgetown-view-component#8

@davidrapson davidrapson added the bug Something isn't working label Jan 8, 2024
@marianayovcheva
Copy link
Contributor

@davidrapson I've had a look at that last Friday but reached a bit of a deadend. What I found so far was that it happens because of the "Ensure HTML output safety" feature which was added to in view_component 3.9: https://github.com/ViewComponent/view_component/pull/1950/files#diff-b69c75ffd85596e0b5fca1327059ecf3b2930f3f77004c78a268fa85e8ec8d9eR310. I think the problem is that in Bridgetown request and controller are nil (in normal rails apps request has a value so the code can proceed) and we hit an error. I hope this is something we would be able to resolve our end, but I'm a bit concerned if it ends up related to the bridgetown-view-component gem. The gem hasn't been updated in two years at which point it was written to support view_component 2

@davidrapson
Copy link
Contributor Author

Yeah that looks like it! I think the "two years ago" on bridgetown-view-component is misleading, the last release was Jan 2023.

Going to pin the version for now but if you are up for it I reckon it's worth seeing if we can pull together a reduced test case bridgetown project with just enough set up to reproduce the issue.

If it does end up being something that needs fixing upstream having a good minimal example of the issue will help us fix it.

@marianayovcheva
Copy link
Contributor

Sounds like a good plan, thanks! Not sure when I'll have the chance to look further into it though - meaning that it's open to anyone who's interested in the meanwhile.

davidrapson added a commit that referenced this issue Jun 5, 2024
ViewComponent 3.9+ introduced a change which depends on there being an active Rails
request or controller in order to conditionally escape HTML. This causes an issue
when run in bridgetown as there's no request and we're always rendering static html.
Monkey patch the relevant method to remove the request format check.

Fixes #3145
davidrapson added a commit that referenced this issue Jun 5, 2024
ViewComponent 3.9+ introduced a change which depends on there being an active Rails
request or controller in order to conditionally escape HTML. This causes an issue
when run in bridgetown as there's no request and we're always rendering static html.
Monkey patch the relevant method to remove the request format check.

Fixes #3145
davidrapson added a commit that referenced this issue Jun 5, 2024
ViewComponent 3.9+ introduced a change which depends on there being an active Rails
request or controller in order to conditionally escape HTML. This causes an issue
when run in bridgetown as there's no request and we're always rendering static html.
Monkey patch the relevant method to remove the request format check.

Fixes #3145
davidrapson added a commit that referenced this issue Jun 5, 2024
ViewComponent 3.9+ introduced a change which depends on there being an active Rails
request or controller in order to conditionally escape HTML. This causes an issue
when run in bridgetown as there's no request and we're always rendering static html.
Monkey patch the relevant method to remove the request format check.

Fixes #3145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants