Skip to content

Commit

Permalink
Don't add parameters changes to browser's history
Browse files Browse the repository at this point in the history
  • Loading branch information
kravets-levko committed Jan 20, 2020
1 parent 2755e12 commit f8e7334
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/app/components/Parameters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function updateUrl(parameters) {
parameters.forEach(param => {
extend(params, param.toUrlParams());
});
location.setSearch(params);
location.setSearch(params, true);
}

export default class Parameters extends React.Component {
Expand Down
15 changes: 9 additions & 6 deletions client/app/components/items-list/classes/StateStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ export class UrlStateStorage extends StateStorage {

// eslint-disable-next-line class-methods-use-this
setState({ page, itemsPerPage, orderByField, orderByReverse, searchTerm }) {
location.setSearch({
page,
page_size: itemsPerPage,
order: compileOrderBy(orderByField, orderByReverse),
q: searchTerm !== "" ? searchTerm : null,
});
location.setSearch(
{
page,
page_size: itemsPerPage,
order: compileOrderBy(orderByField, orderByReverse),
q: searchTerm !== "" ? searchTerm : null,
},
true
);
}
}
6 changes: 3 additions & 3 deletions client/app/pages/dashboards/useDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function useFullscreenHandler() {
const [fullscreen, setFullscreen] = useState(has(location.search, "fullscreen"));
useEffect(() => {
document.body.classList.toggle("headless", fullscreen);
location.setSearch({ fullscreen: fullscreen ? true : null });
location.setSearch({ fullscreen: fullscreen ? true : null }, true);
}, [fullscreen]);

const toggleFullscreen = () => setFullscreen(!fullscreen);
Expand All @@ -83,7 +83,7 @@ function useRefreshRateHandler(refreshDashboard) {
const [refreshRate, setRefreshRate] = useState(getRefreshRateFromUrl());

useEffect(() => {
location.setSearch({ refresh: refreshRate || null });
location.setSearch({ refresh: refreshRate || null }, true);
if (refreshRate) {
const refreshTimer = setInterval(refreshDashboard, refreshRate * 1000);
return () => clearInterval(refreshTimer);
Expand All @@ -100,7 +100,7 @@ function useEditModeHandler(canEditDashboard, widgets) {
const [doneBtnClickedWhileSaving, setDoneBtnClickedWhileSaving] = useState(false);

useEffect(() => {
location.setSearch({ edit: editingLayout ? true : null });
location.setSearch({ edit: editingLayout ? true : null }, true);
}, [editingLayout]);

useEffect(() => {
Expand Down

0 comments on commit f8e7334

Please sign in to comment.