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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with rendering application.js.erb file after upgrading to 6.2.0 #1152

Closed
jalyna opened this issue Oct 5, 2023 · 4 comments
Closed

Comments

@jalyna
Copy link

jalyna commented Oct 5, 2023

Thanks for the work on this project and also the latest big release of 6.2.0 馃檹馃徎

When upgrading to 6.2.0 (same issue also exist with 6.2.3) I discovered a bug when using haml with the latest rails version that when there are two layout files e.g. application.js.erb and application.html.haml and are doing a request with the header Accept: text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01 it will respond with the contents of the application.html.haml instead of the application.js.erb. We are using this logic pre-turbo to render modals.

I wonder if this is supposed to work. I was also having a look at #1146 but understanding the implications was difficult to me.

If you need more information, I could also setup a small demo rails app later.

Thanks for all your help!

@timdiggins
Copy link
Contributor

@jalyna I tried to make a repro of this (thought it might be connected to #1154 but doesn't seem to be) in https://github.com/timdiggins/haml-issue-1154/compare/issue-1152?expand=1 but I couldn't make it work.

Can you give an detailed example?

(PS I have uses of haml in pre-turbo js responses in apps I manage also, so am interested in finding out when this occurs)

@jalyna
Copy link
Author

jalyna commented Oct 10, 2023

@timdiggins Thanks a lot for taking a look. I will crate a minimal use case later. The first thing that is maybe different in your suggested branch is that there needs to be also an application.html.haml present and I also don't have a dedicated js view like show.js.erb but there is a show.haml (which uses content_for(:modal) do ...). Sorry for leaving this out in my initial description.

@timdiggins
Copy link
Contributor

Ah ok @jalyna then it's perhaps related to changes in 6.1.3 - you might find that 6.1.2 works for you, or you could try the workaround (making default_format return nil) in #1154 (comment). (see also discussion in #1144)

@k0kubun
Copy link
Member

k0kubun commented Dec 10, 2023

Please give v6.3.0 a try.

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

No branches or pull requests

3 participants