fix: allow running ya.sync in a sync plugin call (#702)

This commit is contained in:
Diogo Duarte 2024-02-20 18:16:17 +00:00 committed by GitHub
parent 2e9b6b7b7b
commit ed22be731a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,10 @@ function ya.flat(t)
end end
function ya.sync(f) function ya.sync(f)
if ya.SYNC_ON then
return function(...) f(...) end
end
YAZI_SYNC_BLOCKS = YAZI_SYNC_BLOCKS + 1 YAZI_SYNC_BLOCKS = YAZI_SYNC_BLOCKS + 1
if YAZI_SYNC_CALLS == YAZI_SYNC_BLOCKS then if YAZI_SYNC_CALLS == YAZI_SYNC_BLOCKS then
YAZI_SYNC_ENTRY = f YAZI_SYNC_ENTRY = f