-
Notifications
You must be signed in to change notification settings - Fork 529
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
fix(insights): only init
if version
allows it
#5529
Conversation
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:
|
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
b345868
to
a972714
Compare
b4e9504
to
7f415a8
Compare
a972714
to
c5c1da4
Compare
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 should be good once those versions are released. Needs a test of course then
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. |
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
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'm not convinced we should return if we can't init (as it realistically should be optional or done by the user)
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts # tests/mocks/createInsightsClient.ts
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 this is the way to go!
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # bundlesize.config.json
packages/instantsearch.js/src/middlewares/__tests__/createInsightsMiddleware.ts
Show resolved
Hide resolved
packages/instantsearch.js/src/middlewares/createInsightsMiddleware.ts
Outdated
Show resolved
Hide resolved
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.
LGTM. I'm stealing the comment description of isModernInsightsClient()
for my PR 😛!
Thanks a lot @dhayab! |
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
Summary
FX-2283
Alternative to #5523
If
init
has already been called outside onsearch-insights
, callinginit
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 withpartial: true
option to update options without clearing them when a user pass a custom middleware.init
is called wheninsightsInitParams
are passed (even if it's the default Insights middleware).