Please read Read before posting: How do I get my question answered?
In particular, the code you post must minimal, but complete, i.e. something anyone could copy and paste.
That’s most likely not equivalent. In the old code you have a FE space with four unknowns, while in the code you have a FE space with mesh.geometry.dim
unknowns (which, I guess, is not four, unless you really have a 4D mesh)