Removes gotoPage action in favor of setPage (#33175) (#33190)

This commit is contained in:
Corey Robertson 2019-03-15 09:20:32 -04:00 committed by GitHub
parent 14f693e0f3
commit e6391ceba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 15 deletions

View file

@ -9,7 +9,7 @@ import { notify } from '../../lib/notify';
import { getDefaultWorkpad } from '../../state/defaults';
import { setWorkpad } from '../../state/actions/workpad';
import { setAssets, resetAssets } from '../../state/actions/assets';
import { gotoPage } from '../../state/actions/pages';
import { setPage } from '../../state/actions/pages';
import { getWorkpad } from '../../state/selectors/workpad';
import { isFirstLoad } from '../../state/selectors/app';
import { setCanUserWrite, setFirstLoad } from '../../state/actions/transient';
@ -88,7 +88,7 @@ export const routes = [
// set the active page using the number provided in the url
const pageIndex = pageNumber - 1;
if (pageIndex !== workpad.page) {
dispatch(gotoPage(pageIndex));
dispatch(setPage(pageIndex));
}
},
meta: {

View file

@ -8,7 +8,6 @@ import { createAction } from 'redux-actions';
export const addPage = createAction('addPage');
export const duplicatePage = createAction('duplicatePage');
export const gotoPage = createAction('gotoPage');
export const movePage = createAction('movePage', (id, position) => ({ id, position }));
export const removePage = createAction('removePage');
export const stylePage = createAction('stylePage', (pageId, style) => ({ pageId, style }));

View file

@ -18,7 +18,7 @@ import {
} from '../actions/elements';
import { restoreHistory } from '../actions/history';
import { selectElement } from '../actions/transient';
import { addPage, removePage, duplicatePage, gotoPage } from '../actions/pages';
import { addPage, removePage, duplicatePage, setPage } from '../actions/pages';
import { appReady } from '../actions/app';
import { setWorkpad } from '../actions/workpad';
import { getNodes, getPages, getSelectedPage, getSelectedElement } from '../selectors/workpad';
@ -59,7 +59,7 @@ const aeroelasticConfiguration = {
const isGroupId = id => id.startsWith(aeroelasticConfiguration.groupName);
const pageChangerActions = [gotoPage.toString(), duplicatePage.toString(), addPage.toString()];
const pageChangerActions = [duplicatePage.toString(), addPage.toString(), setPage.toString()];
/**
* elementToShape

View file

@ -80,16 +80,6 @@ export const pagesReducer = handleActions(
return setPageIndex(workpadState, payload);
},
[actions.gotoPage]: (workpadState, { payload }) => {
const newState = setPageIndex(workpadState, payload);
// changes to the page require navigation
const router = routerProvider();
router.navigateTo('loadWorkpad', { id: newState.id, page: newState.page + 1 });
return newState;
},
[actions.movePage]: (workpadState, { payload }) => {
const { id, position } = payload;
const pageIndex = getPageIndexById(workpadState, id);