I spent some time investigating that but finally I got a fix https://github.com/discourse/discourse/pull/8218