Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite build & reload loop when saving FFI file #71

Open
mdarse opened this issue Sep 2, 2024 · 1 comment
Open

Infinite build & reload loop when saving FFI file #71

mdarse opened this issue Sep 2, 2024 · 1 comment

Comments

@mdarse
Copy link

mdarse commented Sep 2, 2024

When using the live reload feature (gleam run -m lustre/dev start), each time I save an FFI (.mjs) file, the process fall in an infinite loop that triggers infinite reloads in the browser.

I run macOS 14.6.1, and could reproduce the issue with multiple editors including Zed & vi.

After quite a bit of digging around the fs module I found that after an initial (and correct) change detected on the saved FFI file (with events [Inodemetamod, Modified]), I get another change on this same file with the same events but a change on every other FFI files with the [] events. Then this loops again.

I’ve found a workaround by commenting out these two lines.

use module <- try(get_module_interface(project_name))
use _ <- try(check_main_function(project_name, module))

So the issue seems related to the gleam compiler exporting the package information (or an interaction between this and the regular build process).

Sometime the build loop stops after some time, most of the time not. So we may have a race somewhere.

@hayleigh-dot-dev
Copy link
Contributor

Oh how odd, I would think neither of those two things would trigger any fs events at all 🤔 I think @giacomocavalieri may have mentioned sometimes getting stuck in a similar loop but it's not something I've managed to run into yet (also Mac, also Zed).

I'll try to investigate, thank you for digging into it already!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants