Electronic (flux gate) compasses have a "damping" factor that you can often change. A high damping value will cause sluggish compass response, but a steadier reading. That's how it's supposed to
work, since it's harder to read rapidly-changing digits than it is to read a rotating mechanical compass card.
Your compass could have a problem, but look for a damping or filtering option and play with that before you panic.