mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(settings): keep pubsub visibility stable before refresh
This commit is contained in:
@@ -232,6 +232,9 @@ describe('AdvancedSettings', () => {
|
|||||||
await act(async () => {
|
await act(async () => {
|
||||||
checkbox?.click();
|
checkbox?.click();
|
||||||
});
|
});
|
||||||
|
expect(checkbox?.checked).toBe(true);
|
||||||
|
expect(container.textContent).toContain('advanced_pubsub_providers');
|
||||||
|
|
||||||
await clickButton('save_advanced_settings');
|
await clickButton('save_advanced_settings');
|
||||||
|
|
||||||
expect(testState.setAccountMock).toHaveBeenCalledWith(
|
expect(testState.setAccountMock).toHaveBeenCalledWith(
|
||||||
@@ -267,6 +270,9 @@ describe('AdvancedSettings', () => {
|
|||||||
await act(async () => {
|
await act(async () => {
|
||||||
checkbox?.click();
|
checkbox?.click();
|
||||||
});
|
});
|
||||||
|
expect(checkbox?.checked).toBe(false);
|
||||||
|
expect(container.textContent).not.toContain('advanced_pubsub_providers');
|
||||||
|
|
||||||
await clickButton('save_advanced_settings');
|
await clickButton('save_advanced_settings');
|
||||||
|
|
||||||
expect(testState.setAccountMock).toHaveBeenCalledWith(
|
expect(testState.setAccountMock).toHaveBeenCalledWith(
|
||||||
|
|||||||
@@ -270,9 +270,10 @@ const AdvancedSettings = () => {
|
|||||||
const account = useAccount() as AccountShape | undefined;
|
const account = useAccount() as AccountShape | undefined;
|
||||||
const protocolOptions = getProtocolOptions(account);
|
const protocolOptions = getProtocolOptions(account);
|
||||||
const canConfigurePureP2PBrowser = canConfigureBrowserPureP2P();
|
const canConfigurePureP2PBrowser = canConfigureBrowserPureP2P();
|
||||||
|
const activeBrowserPureP2PEnabled = canConfigurePureP2PBrowser && isBrowserPureP2PEnabled(account);
|
||||||
const [browserPureP2PSelection, setBrowserPureP2PSelection] = useState<boolean | undefined>(undefined);
|
const [browserPureP2PSelection, setBrowserPureP2PSelection] = useState<boolean | undefined>(undefined);
|
||||||
const browserPureP2PEnabled = browserPureP2PSelection ?? (canConfigurePureP2PBrowser && isBrowserPureP2PEnabled(account));
|
const browserPureP2PEnabled = browserPureP2PSelection ?? activeBrowserPureP2PEnabled;
|
||||||
const shouldShowGatewayModeSettings = !canConfigurePureP2PBrowser || !browserPureP2PEnabled;
|
const shouldShowGatewayModeSettings = !canConfigurePureP2PBrowser || !activeBrowserPureP2PEnabled;
|
||||||
|
|
||||||
const ipfsGatewayUrlsRef = useRef<HTMLTextAreaElement>(null);
|
const ipfsGatewayUrlsRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const mediaIpfsGatewayUrlRef = useRef<HTMLInputElement>(null);
|
const mediaIpfsGatewayUrlRef = useRef<HTMLInputElement>(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user