Skip to content

Fix caching of directories and cache invalidation when file is created

Loic Huder requested to merge fix-watch into main

The implementation of !55 (merged) was in fact not working: the invalidation of the cache was automatically triggered by swr (https://swr.vercel.app/docs/revalidation) and not when the socket event was caught.

The socket event was in fact not working for the following reasons:

  1. I was using cache.delete instead of mutate
  2. The keys of the cache (that are relative paths) were not corresponding to the keys of the socket payload (that were absolute paths)

I deactivated automatic validation by swr and fixed 1. in this PR. daiquiri!386 (merged) fixes 2. by sending relative paths (instead of absolute) in the socket payload.

Merge request reports

Loading