Not necessarily, but I can’t claim it’ll work without seeing code or reproducing it myself.
That being said, the approach is right, and especially since you are seeing the desired behavior, you can assume it’s working.