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(insights): only init if version allows it #5529

Merged
merged 16 commits into from
Apr 12, 2023

Conversation

FabienMotte
Copy link
Contributor

@FabienMotte FabienMotte commented Mar 6, 2023

Summary

FX-2283

Alternative to #5523

If init has already been called outside on search-insights, calling init in the insights middleware would clear the previous options and we want to avoid that behavior.

Result

  • init is not called when the default Insights middleware is used.
  • init is called with partial: true option to update options without clearing them when a user pass a custom middleware.
  • init is called when insightsInitParams are passed (even if it's the default Insights middleware).

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 6, 2023

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 fd0b44e:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-hooks-default-theme Configuration
example-vue-instantsearch-default-theme Configuration

@FabienMotte FabienMotte force-pushed the fix/insights-init-version branch from b345868 to a972714 Compare March 8, 2023 15:13
@Haroenv Haroenv force-pushed the feat/automatic-insights branch from b4e9504 to 7f415a8 Compare March 8, 2023 16:00
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

this should be good once those versions are released. Needs a test of course then

@FabienMotte
Copy link
Contributor Author

@Haroenv Thanks! Should I close #5523 then?

@Haroenv
Copy link
Contributor

Haroenv commented Mar 9, 2023

Yes, I think #5523 is a dead end. We may need to do it later still if there's an option coming from the response, but that doesn't block this PR I think.

@dhayab dhayab marked this pull request as ready for review March 20, 2023 18:12
@dhayab dhayab requested a review from Haroenv March 20, 2023 18:12
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

I'm not convinced we should return if we can't init (as it realistically should be optional or done by the user)

yarn.lock Outdated Show resolved Hide resolved
@dhayab dhayab marked this pull request as draft March 21, 2023 09:18
@FabienMotte FabienMotte marked this pull request as ready for review April 6, 2023 10:29
@FabienMotte FabienMotte requested review from Haroenv and dhayab April 6, 2023 10:30
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

👍 I think this is the way to go!

@FabienMotte FabienMotte requested a review from sarahdayan April 7, 2023 16:30
Copy link
Member

@dhayab dhayab left a comment

Choose a reason for hiding this comment

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

LGTM. I'm stealing the comment description of isModernInsightsClient() for my PR 😛!

@FabienMotte
Copy link
Contributor Author

Thanks a lot @dhayab!

@FabienMotte FabienMotte merged commit e489236 into feat/automatic-insights Apr 12, 2023
@FabienMotte FabienMotte deleted the fix/insights-init-version branch April 12, 2023 14:23
Haroenv pushed a commit that referenced this pull request Apr 18, 2023
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
Haroenv pushed a commit that referenced this pull request Apr 24, 2023
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
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.

4 participants