What caused the infantry square to die out after Napoleon?

by FourthCroatian

So, from what I have read, the Napoleonic wars were the last time the infantry formed squares to protect themselves against cavalry, so I have 2 questions:

A) Am I missing any conflict where soliders did square up to meet a cavalry charge?

B) What changed to enable infantry to defend against such a charge without a square?

-trax-

A) Am I missing any conflict where soliders did square up to meet a cavalry charge?

Some units of regulars formed a square at First Bull Run to cover the retreat of the Union army. https://www.army.mil/article/62090/Battle_of_Bull_Run__The_men_who_saved_the_Army

Earlier in the same battle the Fighting 69th formed a moving square and tried to march off the field when threatened by cavalry but the formation was broken by other fleeing units.

https://longislandwins.com/news/national/immigrant-regiments-on-opposite-banks-of-bull-run-2/