Hope this fixes #24369, happy for any feedback on the PR. (cherry picked from commit 1fddb61b3b)
1fddb61b3b