• This repository has been archived on 23/Mar/2022
  • Stars
    star
    1
  • Language Vue
  • Created over 2 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

vue-hmr-repro

HMR only works if the component has an active instance. A regression was introduced in 3.2.11. 3.2.10 behaves as expected.

Most users experience this issue when using vue-router, as no full reload occurs, and is not unusual to navigate between pages.

It can happen in different scenarios, for example, a component that is conditionally displayed. If the user modifies the component file when the condition is false, and then the condition becomes true, the rendered component is outdated and won't reflect current changes until a page reload or another HMR update is sent.

Replication Steps

  • Install packages
  • Run npm run dev
  • Visit http://localhost:3000/about
  • Comment <Welcome/> in src/views/Home.vue
  • Navigate to the Home page
  • The <Welcome/> component is still displayed

Explanation 🐞

When the modified page component:

  • is the current route, it has an active instance, so HMR works.
  • is not the current route, it has no active instances, so HMR does nothing.

As a result, when modifying a component that is not the current route, the HMR update is sent as usual, but it doesn't update the module.

Then, when the route for the modified component is visited, the original module is used, which doesn't include the changes since it was never updated by HMR.

More Subtle for Dynamic Imports

To replicate the bug with lazy routes, the dynamic import must have been resolved.

For example, the bug will not occur in this sequence:

  • Navigate to the Home page
  • Add an exclamation mark to the text in src/views/About.vue
  • Navigate to the About page using the nav link
  • The modified text is displayed

But, if you proceed to:

  • Navigate again to the Home page using the nav link
  • Add another exclamation mark to the text in src/views/About.vue
  • Navigate to the About page using the nav link
  • The last change is not there

More Repositories

1

vite_ruby

⚑️ Vite.js in Ruby, bringing joy to your JavaScript experience
Ruby
1,124
star
2

iles

🏝 The joyful site generator
TypeScript
1,043
star
3

vite-plugin-image-presets

πŸ–Ό Image Presets for Vite.js apps
TypeScript
243
star
4

vite-plugin-environment

Easily expose environment variables in Vite.js
TypeScript
132
star
5

vite-plugin-full-reload

♻️ Automatically reload the page when files are modified
JavaScript
121
star
6

oj_serializers

⚑️ Faster JSON serialization for Ruby on Rails. Easily migrate away from Active Model Serializers.
Ruby
98
star
7

js_from_routes

πŸ›£οΈ Generate path helpers and API methods from your Rails routes
Ruby
86
star
8

request_store_rails

πŸ“¦ Per-request global storage for Rails prepared for multi-threaded apps
Ruby
83
star
9

types_from_serializers

βœ… Generate TypeScript interfaces from your JSON serializers
Ruby
71
star
10

vuex-stores

πŸ—„ Store objects for Vuex, a simple and more fluid API for state-management.
JavaScript
63
star
11

vue-custom-element-example

An example on how to define custom elements using Vue 3
TypeScript
54
star
12

mongoid_includes

🌿 Improves eager loading support for Mongoid
Ruby
46
star
13

jekyll-vite

⚑️🩸 Use Vite.js in Jekyll as your assets pipeline
Ruby
44
star
14

queryable

❔ Gives your queries a home and avoid tucking scopes inside your models
Ruby
42
star
15

vite-plugin-stimulus-hmr

⚑️ HMR for Stimulus controllers in Vite.js
TypeScript
42
star
16

stimulus-vite-helpers

Helpers to easily load all your Stimulus controllers when using Vite.js
TypeScript
37
star
17

capybara-compose

βœ… Easily write fluent integration tests with Capybara in Ruby
Ruby
31
star
18

better_settings

βš™ Settings for Ruby apps – fast, immutable, better.
Ruby
20
star
19

vite-plugin-bugsnag

Report builds and upload source maps to Bugsnag
TypeScript
18
star
20

i18n_multitenant

🌎 Provides a convenient way to use tenant-specific translations
Ruby
16
star
21

vite-plugin-manifest-sri

Subresource Integrity for Vite.js manifest files
JavaScript
13
star
22

resourcerer

✨ Works like magic to dry up your controllers
Ruby
10
star
23

sublime-toggle-dark-mode

🌚🌞 Toggle between dark and light mode in Sublime Text 4
JavaScript
9
star
24

pakiderm

🐘 Pakiderm will never forget the return value
Ruby
7
star
25

presenter_rails

πŸ”­ Expose your view models in a convenient way
Ruby
6
star
26

vite-plugin-erb

Use ERB files in Vite.js projects with a Ruby backend
TypeScript
5
star
27

journeyman

Let your factories use your business logic, making them flexible and easier to update.
Ruby
5
star
28

jekyll-vite-minima

⚑️🩸 Use Vite.js in Jekyll minima theme as your assets pipeline
Ruby
3
star
29

automatic-music-transcription

Automatically exported from code.google.com
C
2
star
30

vite-plugin-xdm

Use XDM in VIte.js
JavaScript
2
star
31

crouton

🍞 Context sensitive notifications for Rails
Ruby
1
star
32

fast-food-mvc

Automatically exported from code.google.com
C#
1
star
33

ElMassimo

1
star