refactor preview dialog promise