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

Fix cache key for coffee script processor #670

Merged
merged 1 commit into from
Jun 23, 2022
Merged

Fix cache key for coffee script processor #670

merged 1 commit into from
Jun 23, 2022

Conversation

code-constructor
Copy link
Contributor

The current implementation leads to a problem with the generation of the sourcemap. Two files with a different name but the same content (e.g. empty files) have different sourcemaps. But the current implementation returns the v3SourceMap of the first file for every subsequent call from the cache. So the commit changes the cache key to be dependent on the filename.

@joergschiller
Copy link

Without that fix there was a strange bug in our codebase.

When Rails tried to javascript_include_tag an empty file called projects.js.coffee it fails with Sprockets::FileNotFound saying that it couldn't find file devise.source.js.coffee.

That was because there is also an empty file devise.js.coffee which already was in input[:cache].

The current implementation leads to a problem with the generation of the sourcemap. Two files with a different name but the same content (e.g. empty files) have different sourcemaps. But the current implementation returns the v3SourceMap of the first file for every subsequent call from the cache. So the commit changes the cache key to be dependent on the filename.
@joergschiller
Copy link

@rafaelfranca sorry for add another thing to your inbox, but short question: Is there anything we can provide you with to get this PR merged?

@danieldiekmeier
Copy link

This looks like the same bug that was already fixed for the Babel Processor 6 years ago: 0bc6763

@rafaelfranca rafaelfranca merged commit 881a819 into rails:main Jun 23, 2022
@danieldiekmeier danieldiekmeier deleted the fix-coffee-processor-caching branch June 30, 2022 20:03
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.

None yet

4 participants