-
Notifications
You must be signed in to change notification settings - Fork 188
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
Add deep link page number to task history page. #1801
Conversation
It looks like this doesn't automatically update the query param when the user clicks through the pagination buttons. We should add that so that these links become discoverable. |
@@ -21,7 +21,7 @@ class UITable extends Component { | |||
sortBy: defaultSortBy, | |||
sortDirection: defaultSortDirection, | |||
sortTime: null, | |||
chunkNum: 1, | |||
chunkNum: initialPageNumber || 1, |
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 could also be done with default props.
{deleted || ( | ||
<TaskHistoryTable | ||
requestId={requestId} | ||
onPageChange={num => router.replace(`${location.pathname}?taskHistoryPage=${num}`)} |
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 works. You could also pass in a location object with a query
prop for react-router. That might be a little safer in terms of ensuring that you don't override any other existing query parameters or the location hash.
@@ -34,6 +34,18 @@ class TaskHistoryTable extends Component { | |||
}; | |||
} | |||
|
|||
componentDidMount() { | |||
const { requestId, initialPageNumber } = this.props; | |||
if (initialPageNumber) { |
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.
How is the data loaded if there is no initialPageNumber? The code for both cases should probably be in a single place.
…askHistoryTable's componentDidMount now that RequestDetailPage now passes the component a default initialPageNumber. Pass router.replace a location object in onPageChage prop for TaskHistoryTable.
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.
Looks like there's a merge conflict now. Aside from that, LGTM
@@ -34,6 +34,16 @@ class TaskHistoryTable extends Component { | |||
}; | |||
} | |||
|
|||
componentDidMount() { | |||
const { requestId, initialPageNumber } = this.props; | |||
this.setState({ loading: true }); |
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 could be set as part of the initial state in the constructor
🚢 |
No description provided.