-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #19068: While user in Pagination, Browser Back button takes them to start page #19229
base: main
Are you sure you want to change the base?
Fix #19068: While user in Pagination, Browser Back button takes them to start page #19229
Conversation
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
This reverts commit a585f3a.
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
cursorValue: string; | ||
currentPage: number; | ||
}>(); | ||
const currentPath = window.location.pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead use useCustomLocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
[cursorState.cursorType]: cursorState.cursorValue, | ||
limit: pageSize, | ||
}); | ||
handlePageChange(cursorState.currentPage as number); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can pass cursor value to page handler and make it work as optional param so if we want to store it we can pass it else it won't be in effect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify once, do you mean:
Passing cursorValue as an optional parameter in tablePaginationHandler?
const tablePaginationHandler = useCallback( ({ cursorType, currentPage, cursorValue}: PagingHandlerParams) => { if (cursorType && cursorValue) { getSchemaTables({ [cursorType]: paging[cursorType] }); storeCursor({ cursorType: cursorType, cursorValue: cursorValue, currentPage: currentPage, }); } handlePageChange(currentPage); }, [paging, getSchemaTables, storeCursor, handlePageChange] );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pointing at this: handlePageChange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handlePageChange is simply a setter function for currentPage in usePaging
handlePageChange: setCurrentPage
@@ -93,6 +94,7 @@ const DatabaseSchemaPage: FunctionComponent = () => { | |||
const { t } = useTranslation(); | |||
const { getEntityPermissionByFqn } = usePermissionProvider(); | |||
const pagingInfo = usePaging(PAGE_SIZE); | |||
const { storeCursor, getStoredCursor } = usePaging(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will be having both in line no. 96 no?
Also we are not passing default values from location?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
interface CursorState { | ||
cursorType: CursorType | null; | ||
cursorValue: string | null; | ||
currentPage: number | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentPage is already there so no need to pull it here sepratly
storeCursor: (params: { | ||
cursorType: CursorType | null; | ||
cursorValue: string | null; | ||
currentPage: number | null; | ||
}) => void; | ||
getStoredCursor: () => CursorState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow same naming as above adn rename getter setter as below
handlePagingCursorChange
pagingCursor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const storeCursor = useCallback( | ||
({ | ||
cursorType, | ||
cursorValue, | ||
currentPage, | ||
}: { | ||
cursorType: CursorType | null; | ||
cursorValue: string | null; | ||
currentPage: number | null; | ||
}) => { | ||
history.replace({ | ||
state: { | ||
cursorType, | ||
cursorValue, | ||
currentPage, | ||
}, | ||
}); | ||
}, | ||
[] | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not storing the cursor it's actually updating location state let's rename something to convey the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return cursorState | ||
? { | ||
cursorType: cursorState.cursorType || null, | ||
cursorValue: cursorState.cursorValue || null, | ||
currentPage: cursorState.currentPage || null, | ||
} | ||
: { cursorType: null, cursorValue: null, currentPage: null }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return cursorState | |
? { | |
cursorType: cursorState.cursorType || null, | |
cursorValue: cursorState.cursorValue || null, | |
currentPage: cursorState.currentPage || null, | |
} | |
: { cursorType: null, cursorValue: null, currentPage: null }; | |
return { | |
cursorType: cursorState.cursorType || null, | |
cursorValue: cursorState.cursorValue || null, | |
currentPage: cursorState.currentPage || null, | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
[cursorState.cursorType]: cursorState.cursorValue, | ||
limit: pageSize, | ||
}); | ||
handlePageChange(cursorState.currentPage as number); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pointing at this: handlePageChange
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Fixes #19068
Screen.Recording.2025-01-03.at.7.39.54.PM.mov
Type of change:
Checklist:
Fixes <issue-number>: <short explanation>