Skip to content

Commit 44bc25f

Browse files
author
Robb Satterwhite
committed
Push to top page upon list deletion when in flat mode.
1 parent b995a64 commit 44bc25f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/OneList.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const OneList = () => {
5353
const oneListRec = getListRec(listID, state);
5454
if (oneListRec===null) {needsRedirect=true;} // this will happen after record deletion
5555
if (needsRedirect) {return (<Redirect to="/" />);} // back to main page if no ID
56+
const isFlatMode = getFlatMode2(state);
5657
const showLoading = state.loading;
5758
const showLogin = !state.loading && !state.loggedIn;
5859
const showMain = !state.loading && state.loggedIn;
@@ -92,10 +93,15 @@ const OneList = () => {
9293
// setAddMode(!getMobile(state));
9394
// }, [state.isMobile]);
9495

96+
// go to parent category page after deletion, or top page if in flat mode
9597
const removeList = async () => {
9698
const status = await handleRemoveList(listID, state, dispatch);
9799
if (status===api.OK) {
98-
if (parentCatID!=null) history.push('/cat/', { categoryID:parentCatID });
100+
if (isFlatMode) {
101+
history.push('/');
102+
} else {
103+
if (parentCatID!=null) history.push('/cat/', { categoryID:parentCatID });
104+
}
99105
}
100106
};
101107

@@ -104,7 +110,6 @@ const OneList = () => {
104110
* flat mode or category mode.
105111
*/
106112
const crumbArea = () => {
107-
const isFlatMode = getFlatMode2(state);
108113
return (
109114
<Fragment>
110115
<div className='crumbsplustwo'>

src/components/SortableItemUnit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function SortableItemUnit(props) {
5555
setItemNote(props.item.itemNote);
5656
};
5757

58+
// show an actual horizontal rule if itemName==='<hr>'
5859
const showHR = props.item.itemName==='<hr>';
5960
return (
6061
<Fragment>

0 commit comments

Comments
 (0)