Ok I’m pretty sure I’ve got it right this time Thanks!
https://github.com/angusmcleod/discourse-header-search-theme/commit/6171f30e37ad72dd1294743cf208d34f85824a03