Avoiding setting state to what it already is.