Skip to content
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

fixed bug of pagination disappearing after a custom query state update #202

Closed

Conversation

NRodriguezcuellar
Copy link

the pagination menu was disappearing after using the custom query build helper of ILS. After investigation i learned that this was because it defaulted back to the initial state if no page number or size was passed while updating the state. It now takes the current values if those 2 properties are not passed with the payload.

closes inveniosoftware/react-invenio-app-ils#344

dispatch({
type: SET_QUERY_STATE,
payload: queryState,
payload: {size, page, ...queryState},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: would it be safer or more correct to this the following instead?

Suggested change
payload: {size, page, ...queryState},
const { query: currentQueryState } = getState()
payload: {...currentQueryState, ...queryState},

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it in terms of safeness there is no big difference, because it both cases the new queryState object will override either the whole currentQueryState or just the page and size properties, if it has overlapping properties. At least that is how i interpret safeness 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pagination: Pagination disappears
3 participants