I suggest adding sorting support for Compartment using the Inventory Bogo Sorter mod. I have already suggested to the authors of this mod to implement support from their end, but they were unable to figure out how to do it.
The problem is not present when using individual Apiarist/Botanist/etc. databases, nor when using the last build from the original Binnie's Mods project. As such, it seems to be a regression introduced somewhere in this fork.