relaxed-coral
relaxed-coral7mo ago

When sidebar is collapsed, changing page on paginated list open sidebar menu item

When changing the page, the page and offset query parameter of path is modified and is detected as a new navigation
No description
2 Replies
kapa.ai
kapa.ai7mo ago
Hi @Campa. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Refine provides a syncWithLocation property that allows you to edit query parameters manually. This property can be used to share the current page, items count per page, sort, and filter parameters easily with others. When this property is set to true, the URL will include all the necessary parameters like current page, page size, sort, and order. Here is an example of how to use it:
function App() {
return (
<ThemeProvider theme={LightTheme}>
<CssBaseline />
<GlobalStyles styles={{ html: { WebkitFontSmoothing: "auto" } }} />
<RefineSnackbarProvider>
<Refine
...
options={{
mutationMode: "undoable",
syncWithLocation: true
}}
/>
</RefineSnackbarProvider>
</ThemeProvider>
);
}

export default App;
function App() {
return (
<ThemeProvider theme={LightTheme}>
<CssBaseline />
<GlobalStyles styles={{ html: { WebkitFontSmoothing: "auto" } }} />
<RefineSnackbarProvider>
<Refine
...
options={{
mutationMode: "undoable",
syncWithLocation: true
}}
/>
</RefineSnackbarProvider>
</ThemeProvider>
);
}

export default App;
In this example, when you navigate to a different page in a paginated list, the URL will be updated with the new page number and offset. This change in the URL is detected as a new navigation, which could cause the sidebar menu to open. If you want to prevent the sidebar from opening when navigating to a different page in a paginated list, you might need to customize the behavior of the sidebar. Unfortunately, the provided extracts do not contain enough information on how to achieve this. You might find more information in the Refine documentation (https://refine.dev/docs). Source: Refine Blog (https://refine.dev/blog/build-admin-panel-with-material-ui-and-strapi#sharing-the-current-page-with-filters) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@374304938735435787> kapa.ai is still learning and improving, please let us know how it did by reacting below