CompositionalIT / SAFE-Dojo

An introductory dojo to learn how to develop full stack web applications in F#
378 stars 126 forks source link

Note from using Dojo - race condition on save #108

Closed dsyme closed 3 years ago

dsyme commented 3 years ago

I notice some kind of race condition in the watch mode from dotnet run which seems unfortunate

I change something in, say Index.fs, save the file, and the app disappears, and what I get in the log is this:

This seems to be because the background build is seeing an empty file on file save, likely racing with the write of the file.

Re-editing and saving and reloading eventually makes this go away

Do you know where I should report this?

client: Fable compilation finished in 3ms
client: E:/GitHub/dsyme/SAFE-Dojo/src/Client/Index.fs(1,1): (1,1) error FSHARP: Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. (code 222)
client: Watching ..
client: E:/GitHub/dsyme/SAFE-Dojo/src/Client/App.fs(11,25): (11,29) error FSHARP: The value, constructor, namespace or type 'init' is not defined. (code 39)
client: i ?wdm?: Hash: 3d2125395f875d3284fd
client: Version: webpack 4.46.0
client: Time: 141ms
client: Built at: 14/07/2021 13:51:16
client:                                          Asset       Size       Chunks                               Chunk Names
client:           166c1aa5b9b432042c80.hot-update.json   64 bytes               [emitted] [immutable] [hmr]
client:         app.166c1aa5b9b432042c80.hot-update.js   37.9 KiB          app  [emitted] [immutable] [hmr]  app
client:                                         app.js   2.21 MiB          app  [emitted]                    app
client:                                     index.html  540 bytes               [emitted]
client: vendors~app.166c1aa5b9b432042c80.hot-update.js   34.5 KiB  vendors~app  [emitted] [immutable] [hmr]  vendors~app
client:                                 vendors~app.js   3.85 MiB  vendors~app  [emitted]                    vendors~app
client: Entrypoint app = vendors~app.js vendors~app.166c1aa5b9b432042c80.hot-update.js app.js app.166c1aa5b9b432042c80.hot-update.js
client: [./Index.fs.js] 2 bytes {app} [built]
client: E:/GitHub/dsyme/SAFE-Dojo/src/Client/App.fs(11,36): (11,42) error FSHARP: The value, constructor, namespace or type 'update' is not defined. (code 39)
client:     + 128 hidden modules
client: E:/GitHub/dsyme/SAFE-Dojo/src/Client/App.fs(11,49): (11,53) error FSHARP: The value, constructor, namespace or type 'view' is not defined. (code 39)
client: Child html-webpack-plugin for "index.html":
client:      1 asset
client:     Entrypoint undefined = index.html
client:        4 modules
client: i ?wdm?: Compiled successfully.
dsyme commented 3 years ago

This is due to my using an external hard disk file system whose driver is notoriously bad at sending correct file change events.

Moving the copy of the Dojo to my main internal file system fixed things