Closed jwoLondon closed 4 years ago
Thanks for the detailed description of the bug. I’m aiming to take a look at it next weekend if things go as planned. Let’s see if we can batch anything else 🙂
It turns out that the problem was to do with Atom caching the result of require()
If it fails once because a file is absent, Atom does not retry. Replacing require
with readJson
from fs-extra
resolves this problem.
Release pending. I’d like to do a bit of a cleanup before cutting it.
It would appear that caching of previously compiled code blocks is not working correctly in Atom.
The following tested with Atom 1.5.0, VSCode 1.48.2 and markdown-preview-enhanced-with-litivs 0.28.0 (all the latest at time of writing). The problem was also present in the previous version of markdown-preview-enhanced-with-litivs.
I've added a caching test to demonstrate the problem. After clearing the cache, first previewing of the test file takes around 10 seconds to evaluate. Editing the markdown after this should re-render output in the preview window without re-evaluating the expensive function and so should be effectively instant. However, in Atom it appears to re-evaluate, taking another 10 seconds. Even pressing the 'refresh' icon in the preview window appears to force a re-evaluation.
The problem does not occur in VSCode where the document is relying on a cached version of the evaluated function as expected.