`.then` for toggleSubdirectories should saveTreeState at the correct time.