add loading page when state changes