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

Force SockJS client to perform a Turbolinks page reload #2586

Closed
michaelbaudino opened this issue May 13, 2020 · 1 comment
Closed

Force SockJS client to perform a Turbolinks page reload #2586

michaelbaudino opened this issue May 13, 2020 · 1 comment

Comments

@michaelbaudino
Copy link

michaelbaudino commented May 13, 2020

Hi there,

On a fresh Rails 6 install, we are using the following snippet in config/webpack/development.js to ask the browser to reload the page when we modify a Rails view (adapted from this comment from a Webpack dev):

const chokidar = require('chokidar')
environment.config.devServer.before = (_app, server) => {
  chokidar.watch([
    'config/locales/*.yml',
    'app/views/**/*.erb',
    'app/views/**/*.haml',
    'app/views/**/*.slim'
  ]).on('change', () => server.sockWrite(server.sockets, 'content-changed'))
}

Does anyone know how we could ask the browser to perform this page reload using Turbolinks, rather than this full page reload? Is there a way to add a handle for a custom event (other than content-changed) to SockJS client in our Webpacker configuration?

Thanks a lot in advance.

@guillaumebriday
Copy link
Member

Thanks for the example @michaelbaudino! 🙏

I'm not sure that's possible for Turbolinks though :/

I'm closing because it's not directly related to Webpacker.

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

2 participants