Use treeFrom/treeExpandTo settings only in "tree" mode
Fix for https://github.com/pnp/sp-dev-fx-webparts/issues/3684
This commit is contained in:
parent
089162f740
commit
7ba2adde76
|
@ -88,7 +88,7 @@ function pagesReducer(state: PagesState, action: Action): PagesState {
|
|||
}
|
||||
}
|
||||
|
||||
export function usePageApi(currentPageId: number, pageEditFinished: boolean, context: WebPartContext, treeTop: number, treeExpandTo: number): PageApi {
|
||||
export function usePageApi(currentPageId: number, pageEditFinished: boolean, context: WebPartContext, treeTop?: number, treeExpandTo?: number): PageApi {
|
||||
const [pagesState, pagesDispatch] = useReducer(pagesReducer, {
|
||||
parentPageColumnExists: true,
|
||||
userCanManagePages: false,
|
||||
|
|
|
@ -10,7 +10,10 @@ import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
|
|||
import { TreeLayout } from '../Layouts/TreeLayout';
|
||||
|
||||
export const Container: React.FunctionComponent<IContainerProps> = props => {
|
||||
const pagesApi = usePageApi(props.currentPageId, props.pageEditFinished, props.context, props.treeFrom, props.treeExpandTo);
|
||||
// Use props.treeFrom / treeExpandTo value from settings only in display mode "tree"
|
||||
const treeFrom = (props.pagesToDisplay === PagesToDisplay.Tree) ? props.treeFrom : undefined;
|
||||
const treeExpandTo = (props.pagesToDisplay === PagesToDisplay.Tree) ? props.treeExpandTo : undefined;
|
||||
const pagesApi = usePageApi(props.currentPageId, props.pageEditFinished, props.context, treeFrom, treeExpandTo);
|
||||
let controlToRender = undefined;
|
||||
switch (props.pagesToDisplay) {
|
||||
case PagesToDisplay.Ancestors:
|
||||
|
|
Loading…
Reference in New Issue