Very curious to learn the reason why ERC1155Supply._mint() calls ERC1155._mint() before adding the amount to be minted to the totalSupply. What would be potential downsides from turning it around(adding to totalSupply, then call super._mint)?
I'm using the extension - as it probably most commonly is - to secure a max amount that can be minted per tokenId. Ideally, I would like to do a check like the one below, early on in the process, before writing anything to storage.
require (totalSupply(tokenID).add(numberOfTokens) <= maxSupply[tokenID], "Purchase would exceed max supply");
However, due to the described order, ERC1155._mint() calls a contract recipient (
thru _doSafeTransferAcceptanceCheck()) BEFORE the increase in supply resulting from the mint, has been written to storage. An early maxSupply check doesn't prevent a contract-recipient from calling back in, and minting beyond the maximum supply.