-
Notifications
You must be signed in to change notification settings - Fork 357
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
Watch/poll missing changes when files change #2440
Comments
Unfortunately there's not much we can do about this. Sass relies on the operating system and intermediate libraries to notify it when files change on disk, and there's no way for it to tell when that stack is feeding us inaccurate information. You can always use the |
It's also failing to pick up the changes when using --poll option. It seems
like it's caching the sass file that's our entry point where all our @use
statements are.
…On Fri, Nov 22, 2024, 6:08 PM Natalie Weizenbaum ***@***.***> wrote:
Unfortunately there's not much we can do about this. Sass relies on the
operating system and intermediate libraries to notify it when files change
on disk, and there's no way for it to tell when that stack is feeding us
inaccurate information. You can always use the --poll option, which will
be slower in general but more accurate since it just checks the filesystem
directly instead of relying on OS notifications.
—
Reply to this email directly, view it on GitHub
<#2440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFZQXSQONWUMXUV2DAP6I32B62PNAVCNFSM6AAAAABSKGUUHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJVGA3DMNZVG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Okay, that could be an issue on our end. How have you installed Dart Sass? Can you provide a repo along with minimal steps to consistently reproduce the issue? |
I will work on getting a sample environment setup
…On Fri, Nov 22, 2024, 8:44 PM Natalie Weizenbaum ***@***.***> wrote:
Okay, that could be an issue on our end. How have you installed Dart Sass?
Can you provide a repo along with minimal steps to consistently reproduce
the issue?
—
Reply to this email directly, view it on GitHub
<#2440 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFZQXUQ3BK3N2STDGZKKDL2B7MWBAVCNFSM6AAAAABSKGUUHGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJVGE4TSOJUGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Ok this replicates the issue: https://github.com/hcker2000/dart-sass-debug If you checkout v2 and then main and then v2 you will see what happens, it looks like the logic is almost inverted as i am seeing this when I switch back to main from v2:
It should be:
If you add a blank line to main and then save it when the main branch is checked out it will re-compile and be fine. |
I can't reproduce. When I run Note that nothing in this repo actually loads |
Sorry I missed pushing a commit on the v2 branch. pull and try now. I do know that the console shows that it re-compiles but ends up not being correct. |
Okay, that lets me reproduce it. This is indeed our bug. Here's what's happening:
We do debounce events to avoid situations like this, but it looks like our debounce timeout is faster than the polling watcher's delay in reports so it's not working here. It's possible we should also add some additional mtime checks to avoid using stale cached ASTs. |
1. The import cache now tracks the most recent time it actually loaded a stylesheet, so that `--watch` mode can invalidate cached data if it's older than the mtime on disk. This should help catch some cases where the watcher information doesn't match the filesystem. 2. Rather than eagerly recompiling as soon as it knows it needs to, the stylesheet graph now only starts recompiling once it's finished processing a batch of events. This ensures that any cache invalidation is finished before the recompilation happens. 3. The stylesheet graph and import cache now eagerly invalidate all canonicalize results that could be changed by an added or removed file, rather than only those that are implicated by the in-memory ASTs. This avoids issues when the in-memory AST is stale. Closes #2440
1. The import cache now tracks the most recent time it actually loaded a stylesheet, so that `--watch` mode can invalidate cached data if it's older than the mtime on disk. This should help catch some cases where the watcher information doesn't match the filesystem. 2. Rather than eagerly recompiling as soon as it knows it needs to, the stylesheet graph now only starts recompiling once it's finished processing a batch of events. This ensures that any cache invalidation is finished before the recompilation happens. 3. The stylesheet graph and import cache now eagerly invalidate all canonicalize results that could be changed by an added or removed file, rather than only those that are implicated by the in-memory ASTs. This avoids issues when the in-memory AST is stale. Closes #2440
To be more specific when switching git branches with sass --watch or sass --watch --poll it will miss the new @use lines inside the sass file that's supposed to be being watched.
For example if we add the following to branch new-fonts:
@use newfonts
Then switch back to the master branch it will still try to the @use line even though the file and line no longer exist.
The text was updated successfully, but these errors were encountered: