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

fix(configure): pass the latest state to onStateChange #4555

Merged
merged 2 commits into from Oct 30, 2020

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Oct 29, 2020

Summary

This PR fixes the bug configure connector didn't pass the latest state to onStateChange when refine happened from it.

fixes #4421

Result

onStateChange receives the latest state. It's addressed in the integration test.

@eunjae-lee eunjae-lee requested a review from a team October 29, 2020 16:56
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 29, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit da45143:

Sandbox Source
InstantSearch.js Configuration

@ghost ghost requested review from francoischalifour and shortcuts and removed request for a team October 29, 2020 16:56
import { createSearchClient } from '../../../test/mock/createSearchClient';

describe('InstantSearch integration', () => {
it('renders', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

test name should be about configure & onStateChange

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, it was a temporary name. will fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Haroenv
Copy link
Contributor

Haroenv commented Oct 29, 2020

You don't seem to have changed anything related to search state, how does this fix work?

// Update original `widgetParams.searchParameters` to the new refined one
widgetParams.searchParameters = searchParameters;

// Trigger a search with the resolved search parameters
helper.setState(nextSearchParameters).search();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When search happens, it will trigger onStateChange.

image

Before this change, the widgetParams was outdated at this point, now it's updated first, then the search is triggered.

@eunjae-lee eunjae-lee merged commit 6ab76e8 into master Oct 30, 2020
@eunjae-lee eunjae-lee deleted the fix/configure-state branch October 30, 2020 10:20
@francoischalifour
Copy link
Member

Nice fix!

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

Successfully merging this pull request may close these issues.

onStateChange with outdated uiState
4 participants