If any Pokemon flees from you, regardless if you chained it or not, your chain will break.
Running from any Pokemon, regardless if you chained it or not, your chain will stay.
Your chain will also break if you close the game or catch a different species, even of the same family.
Source: Shiny hunting like 30 shinies in Lets Go Eevee