Replace by most recent nonzero
JavaScript (ES6),  22  21 bytes

A=&gt;A.map(x=&gt;A=x||~~A)

Try it online!
Commented
A =&gt;          // A[] = input array
  A.map(x =&gt;  // for each value x in A[]:
    A =       //   update A to:
      x ||    //     either x, if it's not equal to 0
      ~~A     //     or A coerced to an integer otherwise
  )           // end of map()

Because we're re-using the input array \$A[\:]\$ to store the last non-zero value, two special cases arise if the 2nd part of the condition is executed on the 1st iteration:

if \$A[\:]\$ is a singleton array containing \$0\$, ~~A is equal to ~~0
if \$A[\:]\$ is an array of several elements (starting with \$0\$), ~~A is equal to ~~NaN

which gives the expected \$0\$ in both cases.