[Vuejs]-Rails VueJS, component dissapear when navigate to other page

1👍

Some of this is unavoidable. When you have full page reloads (without using a client side router) you are forcing the Vue components on that page to have to be totally re-mounted and re-rendered.

The fixes are:

  • A: Close to what you were getting at, hide loading of these sorts of elements behind a spinner so that they’re less jarring to the user.
  • B: Use a client side router.

Luckily, Rails does come with turbolinks which acts similar to a client side router. You could use turbolinks to probably help the situation, but you still might see some flashing sometimes. I really recommend being clever with how you hide loading assets as well.

Leave a comment