fix(trading): fix hidden sidebars on load (#4583)
This commit is contained in:
parent
ba7b574a07
commit
29f3374c61
@ -54,6 +54,15 @@ describe('deal ticket basics', { tags: '@smoke' }, () => {
|
|||||||
cy.getByTestId(toggleLimit).next('input').should('be.checked');
|
cy.getByTestId(toggleLimit).next('input').should('be.checked');
|
||||||
cy.getByTestId(orderPriceField).should('have.value', '101');
|
cy.getByTestId(orderPriceField).should('have.value', '101');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sidebar should be open after reload', () => {
|
||||||
|
cy.mockTradingPage();
|
||||||
|
cy.getByTestId('deal-ticket-form').should('be.visible');
|
||||||
|
cy.getByTestId('Order').click();
|
||||||
|
cy.getByTestId('deal-ticket-form').should('not.exist');
|
||||||
|
cy.reload();
|
||||||
|
cy.getByTestId('deal-ticket-form').should('be.visible');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
|
@ -14,12 +14,9 @@ import { Settings } from '../settings';
|
|||||||
import { Tooltip } from '../../components/tooltip';
|
import { Tooltip } from '../../components/tooltip';
|
||||||
import { WithdrawContainer } from '../withdraw-container';
|
import { WithdrawContainer } from '../withdraw-container';
|
||||||
import { Routes as AppRoutes } from '../../pages/client-router';
|
import { Routes as AppRoutes } from '../../pages/client-router';
|
||||||
import { persist } from 'zustand/middleware';
|
|
||||||
import { GetStarted } from '../welcome-dialog';
|
import { GetStarted } from '../welcome-dialog';
|
||||||
import { useVegaWallet, useViewAsDialog } from '@vegaprotocol/wallet';
|
import { useVegaWallet, useViewAsDialog } from '@vegaprotocol/wallet';
|
||||||
|
|
||||||
const STORAGE_KEY = 'vega_sidebar_store';
|
|
||||||
|
|
||||||
export enum ViewType {
|
export enum ViewType {
|
||||||
Order = 'Order',
|
Order = 'Order',
|
||||||
Info = 'Info',
|
Info = 'Info',
|
||||||
@ -302,9 +299,7 @@ export const useSidebar = create<{
|
|||||||
init: boolean;
|
init: boolean;
|
||||||
view: SidebarView | null;
|
view: SidebarView | null;
|
||||||
setView: (view: SidebarView | null) => void;
|
setView: (view: SidebarView | null) => void;
|
||||||
}>()(
|
}>()((set) => ({
|
||||||
persist(
|
|
||||||
(set) => ({
|
|
||||||
init: true,
|
init: true,
|
||||||
view: null,
|
view: null,
|
||||||
setView: (x) =>
|
setView: (x) =>
|
||||||
@ -312,12 +307,6 @@ export const useSidebar = create<{
|
|||||||
if (x == null) {
|
if (x == null) {
|
||||||
return { view: null, init: false };
|
return { view: null, init: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { view: x, init: false };
|
return { view: x, init: false };
|
||||||
}),
|
}),
|
||||||
}),
|
}));
|
||||||
{
|
|
||||||
name: STORAGE_KEY,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user