TIL: Be careful with your wagtail javascript

, Jochen

Currently I'm busy replacing my home grown content editing solution for my blog software django-cast with Wagtail. I copied the javascript part needed for the wagtail admin to add audio blocks from the video javascript and forgot to replace all occurrences of videoTitle with audioTitle. Besides being wrong this worked for Wagtail2.

But last week I upgraded to Wagtail4 and now audio blocks are discarded without any error message. What happened? Well, now the javascript error causes wagtail to not include the audio block in the block count that it sends to the server when the page is saved. And the wrong block count number then causes the Wagtail edit form handler to just ignore the block completely 🙃.

TLDR: Copy&paste saved me a few minutes in the short run, but did cost me a few hours of debugging a year later.

Return to blog