Canvas blank after resizing browser

I have a simple little project I created to let my students play with an even parity grid that has a single error in it, to help them practice spotting which bit is wrong. I draw the grid onto a canvas, white blocks representing 0s, black blocks 1s.

It all works well enough as is, but if the browser window is resized, the canvas goes back to gray. I do have a show event on the canvas that I use to initially display the grid and to redisplay when they generate a new grid. That show event doesn’t seem to be triggered during the resize.

Should that show event be firing after a browser resize? Or do I need to use some Javascript for detecting a resize and forcing the canvas to redraw myself?

Here’s the app: https://parity-game.anvil.app

And a clone, in case anyone wants to look to see if I’ve done something obviously wrong: https://anvil.works/build#clone:42CCVKPRSWUMNZR7=V44SO2WHH4PHZLUWWYKVZLLK

I don’t think it does fire again (the exception being when full_width_row is specified under certain conditions where it will fire twice).

I use some JS to detect screen size changes so I can display mobile only forms. Have a look at this thread …

Thanks for the link!