I think doing a refactor and bug fix in separate PRs makes sense. But I would say do the refactor first, and then do the bug fix on top of it. This solves two problems:
* It can make the bug fix diff much easier to read/understand
* It makes the refactor a dependency of the bug fix, so it doesn't end up getting dropped as "not important enough"
Of course, if the refactor automatically makes the bug go away, then it's fine to do a single PR, because the refactor is the bug fix.
* It can make the bug fix diff much easier to read/understand
* It makes the refactor a dependency of the bug fix, so it doesn't end up getting dropped as "not important enough"
Of course, if the refactor automatically makes the bug go away, then it's fine to do a single PR, because the refactor is the bug fix.