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

feat: pass insights option default to undefined #1198

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Oct 5, 2023

This PR updates the insights option's default value to undefined. This doesn't change any existing behavior, but lets us differentiate between an explicit false value and the option being unset.

https://algolia.atlassian.net/browse/FX-2642

@@ -69,11 +69,11 @@ export function createAutocomplete<
}

if (
options.insights &&
props.insights &&
Copy link
Member Author

Choose a reason for hiding this comment

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

We were previously using the passed option, not the defaulted one—this changes it.

Copy link
Contributor

Choose a reason for hiding this comment

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

you could also leave this as options, and change getDefaultProps

Copy link
Member Author

Choose a reason for hiding this comment

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

I find it cleaner to always rely on props as there's no ambiguity about what we're manipulating.

Copy link
Contributor

Choose a reason for hiding this comment

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

Somewhat inconsistent with the other parts of the code which rely on options, but ok.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 5, 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 9bbfd17:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

@sarahdayan sarahdayan marked this pull request as ready for review October 5, 2023 14:00
packages/autocomplete-core/src/types/index.ts Outdated Show resolved Hide resolved
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.

Good with dhaya’s suggestion

@@ -69,11 +69,11 @@ export function createAutocomplete<
}

if (
options.insights &&
props.insights &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Somewhat inconsistent with the other parts of the code which rely on options, but ok.

Copy link
Contributor

@JasonBerry JasonBerry left a comment

Choose a reason for hiding this comment

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

Just needs @dhayab's doc update, but good to go other than that.

@sarahdayan sarahdayan enabled auto-merge (squash) October 9, 2023 12:43
@sarahdayan sarahdayan merged commit 2f5c683 into next Oct 9, 2023
@sarahdayan sarahdayan deleted the feat/insights-default branch October 9, 2023 12:47
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