You're trying to dispatch loading, sleep for a short time, then dispatch change-dateslot. But the browser does not receive these events separately — it gets all of them at once, after the PHP method is finished executing. This means the loader doesn't show before the slots are cleared.