forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Dev server keeps reloading while typing #32

Closed jeffhube closed 4 years ago

jeffhube commented 4 years ago

Describe the bug Whenever I type a character in my component's js file, the dev server will recompile and reload the component in the browser. This makes typing really laggy. It is also completely pointless because it keeps reloading the unchanged file from the disk. Once I save the file it will reload with the changes as expected. The component does not refresh everytime I type a character in the css file, it only happens with the js file.

To Reproduce

  1. Start dev server
  2. View a component in your browser
  3. Edit the component's js file in VSCode
  4. Note that the component keeps reloading in the browser as you type in VSCode

Expected behavior The component should not be reloaded until you save changes. A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

jeffhube commented 4 years ago

I used Process Monitor to watch for file changes, and it appears that this may be caused by the Lightning Web Components extension (salesforce.salesforcedx-vscode-lwc). As I type in a Lightning Web Component's js file, this extension will write to force-app\main\default\lwc\jsconfig.json over and over again, which is probably detected by the dev server, triggering a reload.

procmon

KrisGraySFDC commented 4 years ago

Good catch. Bugging it.

KrisGraySFDC commented 4 years ago

Created two bugs for this.

W-6860946 - Stop saving jsconfig.json so much W-6860931 - Updates to jsconfig.json cause preview to reload.

juvian commented 4 years ago

Same happens to me in Windows 10 but without even typing in vs code. Sometimes I type in an input in chrome from the component I'm trying and it gets refreshed, very frustrating to try out the component. It's also due to jsconfig.json being modified, but I don't know what triggers it.

mysticflute commented 4 years ago

Fixes are in progress for this one, and also for the vscode plugin writing too often itself.

bpbuch commented 4 years ago

This has been fixed. You can get the update with sfdx plugins:update.