fix(settings): keep pubsub visibility stable before refresh

This commit is contained in:
Tommaso Casaburi
2026-06-23 16:30:17 +07:00
parent 4737d37967
commit ca5582cffa
2 changed files with 9 additions and 2 deletions
@@ -232,6 +232,9 @@ describe('AdvancedSettings', () => {
await act(async () => {
checkbox?.click();
});
expect(checkbox?.checked).toBe(true);
expect(container.textContent).toContain('advanced_pubsub_providers');
await clickButton('save_advanced_settings');
expect(testState.setAccountMock).toHaveBeenCalledWith(
@@ -267,6 +270,9 @@ describe('AdvancedSettings', () => {
await act(async () => {
checkbox?.click();
});
expect(checkbox?.checked).toBe(false);
expect(container.textContent).not.toContain('advanced_pubsub_providers');
await clickButton('save_advanced_settings');
expect(testState.setAccountMock).toHaveBeenCalledWith(
@@ -270,9 +270,10 @@ const AdvancedSettings = () => {
const account = useAccount() as AccountShape | undefined;
const protocolOptions = getProtocolOptions(account);
const canConfigurePureP2PBrowser = canConfigureBrowserPureP2P();
const activeBrowserPureP2PEnabled = canConfigurePureP2PBrowser && isBrowserPureP2PEnabled(account);
const [browserPureP2PSelection, setBrowserPureP2PSelection] = useState<boolean | undefined>(undefined);
const browserPureP2PEnabled = browserPureP2PSelection ?? (canConfigurePureP2PBrowser && isBrowserPureP2PEnabled(account));
const shouldShowGatewayModeSettings = !canConfigurePureP2PBrowser || !browserPureP2PEnabled;
const browserPureP2PEnabled = browserPureP2PSelection ?? activeBrowserPureP2PEnabled;
const shouldShowGatewayModeSettings = !canConfigurePureP2PBrowser || !activeBrowserPureP2PEnabled;
const ipfsGatewayUrlsRef = useRef<HTMLTextAreaElement>(null);
const mediaIpfsGatewayUrlRef = useRef<HTMLInputElement>(null);