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 issue with upgrading gems breaking Opal compilation in Rails applications due to incorrect Sprockets caching #34

Conversation

AndyObtiva
Copy link
Contributor

Fix issue with upgrading gems breaking Opal compilation in Rails applications due to incorrect Sprockets caching (more details are included below).

In the past, I was forced to run rm -rf tmp/catche after every upgrade of gems that were using Opal.

Now, with this fix, the problem goes away without having to do that anymore.

This was an issue mentioned in Opal Slack as:

I ran into a generally consistent issue when using Opal in a Rails app. If I update my Rails app gem dependencies (like the glimmer-dsl-web gem that depends on Opal or some other gems) and I restart the server, when I access the webpage that uses Opal, it gives me weird errors (they are untraceable to my code). I discovered that the consistent fix for the issue is to always run rm -rf tmp/cache after updating any gems in the Rails app, and then to restart the server afterwards.
I don't run into the issue anymore if I do run rm -rf tmp/cache after updating any gems. Of course, the downside to this is I lose caching, so the next request takes a little longer than normal. Also, it requires a manual step from me after updating any gems.
This seems to be caused by the way Opal caches data in the Rails server. It must have a bug that breaks it if the Ruby gems change (like changing versions or perhaps changing gem paths given that gems have the version number in their path name).
I just wanted to note it in case you are not aware of this issue so that you would fix it.

@hmdne hmdne merged commit a56f8b5 into opal:master Aug 8, 2024
8 checks passed
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.

2 participants