UUPS Proxies with ERC165, how to update interface id?

Hi,

Firstly thank to this detailed awesome tutorial; UUPS Proxies: Tutorial (Solidity + JavaScript)

When "initialize" function has parameters, how to change next version these values ? Example ERC165 interface id. I created manually without interface object via bytes4 & keccak. I should change this in updated version, how to I do?

I guess, I can write both previus version and next version changable function for my contract TYPE_HASH storage value. But is it correctly way? I am not sure.

What do you thinks about this ?

I want to put splitted my codes, maybe it is helpful more than my question.

// contracts/Version.sol
contract Version is Initializable, ERC165Upgradeable, UUPSUpgradeable, OwnableUpgradeable {
    // ERC164 Interface Id
    bytes4 TYPE_HASH;

    // Contract owner
    address COWNER;

    // ...

    function initialize(bytes4 type_hash, uint256 continueIndex) initializer public {
        TYPE_HASH = type_hash;
        COWNER = msg.sender;

        // ...

        __ERC165_init();
        __Ownable_init();
    }

    // ...

    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return 
            interfaceId == TYPE_HASH ||
            super.supportsInterface(interfaceId);
    }
}
// contracts/Version_v2.sol
contract Version_v2 is Version {
    function version() public pure returns(string memory) {
        return "v2";
    }
}
// tests/sample-test.js
beforeEach(async () => {
    let Version_Factory = await hre.ethers.getContractFactory("Version");
    Version = await upgrades.deployProxy(Version_Factory, ["0x4d74b2d4", BigNumber.from(0)], {kind: 'uups'}); 
});

// ...

it("UUPS Test", async function (){
    let Version_v2_Factory = await hre.ethers.getContractFactory("Version_v2");
    Version_v2 = await upgrades.upgradeProxy(Version, Version_v2_Factory);
    
    expect(await Version_v2.version()).to.equal("v2");
});

Thank you for interest.
Good works.

We currently don't have an out of the box way to reinitialize a proxy when you upgrade it.

We're working on this for the next release of OpenZeppelin Contracts, but in the meantime you'd need to define a function like initializeV2 that initializes your variables and is somehow protected so it can't be re-invoked (though you can't use Initializable for this purpose).

Hmm, I understood.

I guess, I will use ERC165Storage solve this for my problem. Because, V2 Interface Id will should be change.

Thank you for interest.