[fix] sync readdir and only emit event after all pagelets are optimized