`Viewer.switchToView` JavaScript API function initialized All Object Visible Flags

How Can I Avoid this problem?

Object visibility in Shapespark is defined per view. If you use switchToView API call objects hidden in the previously active view become visible and object that are configured to be hidden in the view that you switch to become visible.