From 6d0ae669f91ea642d436a817ecf3b528079ac5ac Mon Sep 17 00:00:00 2001 From: stffabi Date: Sat, 12 Nov 2022 07:08:54 +0100 Subject: [PATCH] [dev] Fix noreload flag and only skip reloads triggered by assetdir (#2081) --- v2/cmd/wails/internal/commands/dev/dev.go | 12 +++++------- website/src/pages/changelog.mdx | 3 +++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/v2/cmd/wails/internal/commands/dev/dev.go b/v2/cmd/wails/internal/commands/dev/dev.go index f9d9a30f..1ae464b6 100644 --- a/v2/cmd/wails/internal/commands/dev/dev.go +++ b/v2/cmd/wails/internal/commands/dev/dev.go @@ -572,6 +572,9 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc assetDir := "" changedPaths := map[string]struct{}{} + // If we are using an external dev server, the reloading of the frontend part can be skipped or if the user requested it + skipAssetsReload := (flags.frontendDevServerURL != "" || flags.noReload) + assetDirURL := joinPath(devServerURL, "/wails/assetdir") reloadURL := joinPath(devServerURL, "/wails/reload") for quit == false { @@ -662,11 +665,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc } } - if flags.frontendDevServerURL != "" { - // If we are using an external dev server, the reloading of the frontend part can be skipped - continue - } - if len(changedPaths) != 0 { + if !skipAssetsReload && len(changedPaths) != 0 { if assetDir == "" { resp, err := http.Get(assetDirURL) if err != nil { @@ -692,8 +691,6 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc } else if len(dirsThatTriggerAReload) == 0 { LogRed("Reloading couldn't be triggered: Please specify -assetdir or -reloaddirs") } - - changedPaths = map[string]struct{}{} } if reload { reload = false @@ -702,6 +699,7 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc LogRed("Error during refresh: %s", err.Error()) } } + changedPaths = map[string]struct{}{} case <-quitChannel: LogGreen("\nCaught quit") quit = true diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 20927f5d..73fcce10 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- The `noreload` flag in wails dev wasn't applied. Fixed by @stffabi in this [PR](https://github.com/wailsapp/wails/pull/2081) + ## v2.2.0 - 2022-11-09 ### Added