fixed a bug in the view render when caching is turned on

I'm not sure if this is how I'm supposed to do it for consequent PRs so let me know if there's a better way.

hey man, thanks a lot for your quick response in the last PR and merging it so fast. But turns out, I have left out a bug and didn't use the custom view when caching is turned on. I have fixed it so i thought I'll submit this here as well.