plotting – MeshFunctions::invmeshf that resists other solutions

I’m trying to base mesh on the slope of the function. That’s why there is a Cross of two partial derivatives.

With({R = Function(If(Abs(#1) < (Pi)/4, 1, Sec(Abs(#1) - (Pi)/4)))},
  With({F = 
    Function @@ {{(CurlyPhi), 
       h}, {Sin((CurlyPhi)) R((CurlyPhi), h), 
       Cos((CurlyPhi)) R((CurlyPhi), h), h}}}, 
     F((CurlyPhi), h), {(CurlyPhi), -((Pi)/2), (Pi)/2}, {h, -1, 
      1}, MeshFunctions -> #1, 
     Mesh -> {{0}}) &@{Function @@ {{(CurlyPhi), h}, 
      Norm({#1, #2, #3}) & @@ Cross(!(
*SubscriptBox(((PartialD)), (h))(F((CurlyPhi), h))), !(
*SubscriptBox(((PartialD)), ((CurlyPhi)))(F((CurlyPhi), 

The graph is plotted, but the mesh is not, and there is an error message:

MeshFunctions::invmeshf: "MeshFunctions->Function({φ,h},Sqrt(Abs(Cos(<<1>>) If(<<3>>)+If(<<3>>) Sin(<<1>>))^2+Abs(-Cos(<<1>>) If(<<3>>)+If(<<3>>) Sin(<<1>>))^2)) must be a pure function or a list of pure functions."

Quite suddenly, when R is replaced by Function(1), the error disappears. But I don’t need 1.

I tried renaming the arguments to the mesh function (to no avail), I turned the option into an argument to ParametricPlot3D& (to no avail), I turned Function() into Function@@{} (to no avail). Now I’m at a loss.