add hook for viewpage change