[internal] index file should be invalidate when input file is newer #8017
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the input file is newer that the index file stored, then we should consider it outdated
this way is will be rewritten with newer content. cc @dragonstyle as we discussed
Context
Found while looking at #8016
The index file is read from local storage as a cache, but I notice that a complete unrelated version of my
index.qmd
was internally loaded while debugging. This is because we were finding the .qmd was newer but re-reading the existing (wrong) index file which leads the futher processing below to use an unrelated content to my realindex.qmd
quarto-cli/src/project/project-index.ts
Lines 136 to 143 in bac63d8
quarto-cli/src/project/project-config.ts
Lines 97 to 115 in bac63d8
This PR makes sure we return
undefined
to make clear that no index file is found becausestale
. it will then be rewritten.This is there since several month, I am surprised we were not bitten by that, but I am pretty sure something is not right. I believe this is fixed is the right one but unsure.
The new logic since performance fix (#5245) is more complex than the previous one which was
quarto-cli/src/project/project-index.ts
Lines 182 to 198 in 9f61990
So hopefully I got it right