This heavily depends on the state.
E.g. NY is not friendly in this scenario depending on the type of permit and the type of hold. An involuntary hold will impact your right to have a gun.