  The ordering wave vector $\mathbf{Q}$ of a spin density wave (SDW),
stabilized within the superconducting state of $\mathrm{CeCoIn_5}$ in a high
magnetic field, has been shown to be hypersensitive to the direction of the
field. $\mathbf{Q}$ can be switched from a nodal direction of the $d$-wave
superconducting order parameter to a perpendicular node by rotating the
in-plane magnetic field through the antinodal direction within a fraction of a
degree. Here, we address the dynamics of the switching of $\mathbf{Q}$. We use
a free energy functional based on the magnetization density, which describes
the condensation of magnetic fluctuations of nodal quasiparticles, and show
that the switching process includes closing of the SDW gap at one $\mathbf{Q}$
and then reopening the SDW gap at another $\mathbf{Q}$ perpendicular to the
first one. The magnetic field couples to $\mathbf{Q}$ through the spin-orbit
interaction. Our calculations show that the width of the hysteretic region of
switching depends linearly on the deviation of magnetic field from the critical
field associated with the SDW transition, consistent with our thermal
conductivity measurements. The agreement between theory and experiment supports
our scenario of the hypersensitivity of the $Q$ phase on the direction of
magnetic field, as well as the magnon condensation as the origin of the SDW
phase in $\mathrm{CeCoIn_5}$.
