[OnePlus 6 ROMs, Kernels, Recoveries, & Other Devel] TheDude:
I have done it in about every order possible at some point or another. If you are flashing factory images then it is probably best to reboot to the system first and make sure everything is working before you flash xXx... However since this is a magisk module and doesn't touch the system it really isn't necessary to flash stock firmware unless you have made other modifications or altereded the system outside of xXx.

If you are flashing the stock full OnePlus6Oxygen_22_OTA_012_all factory image will always flash it to the inactive slot, so if you are running on slot A and flash it you will not see the effects until you reboot into slot B. So if you are installing the mod slot a, you must reboot to recovery on slot b and flash the official factory install then reboot into slot a to see the effects. Also keep in mind that twrp patches both slots, so anytime you are done flashing a official factory update in twrp all you have to do is flash twrp installer before you reboot and you will not lose recovery (won't have to fastboot twrp from computer to reinstall it...)

This may be confusing but if you are wanting to get a clean slate and start over without losing your data then this is how.

Boot twrp.

1 - Click reboot and see what slot is active at bottom (going to assume slot A for this)

2 - Install OnePlus6Oxygen_22_OTA_012_all (or whatever is applicable) This will actually install to slot B.

3 - Don't reboot! Hit the Home button and then install twrp installer zip. TWRP patches both slots boot.img so by doing this you just installed recovery on slot B that you just flashed. Don't reboot!

4 - Hit home, then hit reboot, then set slot B as active. Hit home again, then reboot, and reboot recovery.

At this point you have flashed the factory update to slot B, installed twrp to both slots, set B as active, rebooted recovery and now you are in TWRP again on slot B. You can check this by going to reboot and seeing what slot is active. So now you are on slot B when you flash the factory image it is going to update slot A. Same steps differents slots...

1 - Click reboot and see what slot is active at bottom (going to assume slot B for this now)

2 - Install OnePlus6Oxygen_22_OTA_012_all (or whatever is applicable) This will actually install to slot A.

3 - Don't reboot! Hit the Home button and then install twrp installer zip. TWRP patches both slots boot.img so by doing this you just installed recovery on slot A that you just flashed. Don't reboot!

4- Hit home, then hit reboot, then set slot A as active. Hit home again, then reboot, and reboot recovery.

Now you have clean factory images installed with twrp installed as well and all your data is still there and you are on slot 1.

This will replace anything you have deleted or modified. Personally for me to be extra sure everything is stock, I will also format both system partitions before I go through the above process. So boot twrp slot A - format system. Set B active - reboot to twrp on B - format system. Set A active reboot to twrp on A and then start the above process.

Install your kernel (Elemental X for me)

Install magisk 16.6

Install xXx

Reboot

Done.

These steps are only necessary if you have made modifications to the system partition prior to using xXx, flashed other roms, etc. and are having unexpected results. Also note that the steps above left slot B with only recovery installed. So if you set B active and boot it you will not have magisk root or xXx. Same thing applies for the next system update. If you take the update OTA it will update slot B set it active and boot it. At that point you will not have recovery, root, or twrp on slot B and you will have to fastboot twrp img to get it back. To avoid this you can just download the update, reboot to twrp and flash it there allowing you to flash twrp directly after the update and keep your recovery without needing a computer.

These instructions were probably way overkill and more than you wanted to know but I thought I would throw them out there to try and help people through the process and give them a better understanding of what's going on with all this A/B stuff and how to work around it properly.

Again, these instructions are not the "normal" process and you do NOT have to do this every time you update xXx.

Hope it helps.