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: add redirect url plugin #1082

Merged
merged 55 commits into from
Feb 9, 2023
Merged

feat: add redirect url plugin #1082

merged 55 commits into from
Feb 9, 2023

Conversation

drodriguln
Copy link
Contributor

@drodriguln drodriguln commented Feb 3, 2023

The new Redirect URL plugin is used in conjunction with the dashboard / merchandising studio rule consequence "redirect to a url". It adds an item visually when a redirect matches, and a handler for onSubmit + onSelect to navigate to that URL.

See the RFC here.

capture

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 3, 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 d5f8fc3:

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

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.

For me this looks good, but it requires reviews from other team members, as I've contributed too much of it.

/**
* Functions to navigate to a URL.
*/
navigator: AutocompleteNavigator<TItem>;
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if it's worth providing the whole props here? It feels like just passing navigator solves one scenario, but not others when people will introduce different plugins?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did debate when moving to pass only navigator that it could be interesting to pass the whole props, although as they probably would be spread, I guess it can wait until we have more need?

Copy link
Member

Choose a reason for hiding this comment

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

We pass the state object without spreading so I would rather see the whole props object without spreading, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I see the argument for all of props to be passed in a single object too. I guess I was more thinking on how that's currently not an API we expose, and from now on props would be available too.

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.

Great work! I have a few nitpicks that might help improve user experience.

examples/redirect-url/app.tsx Outdated Show resolved Hide resolved
@Haroenv Haroenv requested a review from dhayab February 8, 2023 16:14
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
state: AutocompleteState<TItem>;
};

type DefaultIndicator = { __default?: boolean };
Copy link
Member

Choose a reason for hiding this comment

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

That's unconventional and not easy to understand why this is needed. Perhaps some JSDoc would help?

type DefaultIndicator = {
  /**
   * ...
   */
  __default?: boolean;
};

Copy link
Member

Choose a reason for hiding this comment

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

In d5f8fc3:

Optional key on a function to indicate it's the default value of this function.

This doesn't explain what it's used for so it doesn't provide much value...

@Haroenv Haroenv merged commit a4f112d into next Feb 9, 2023
@Haroenv Haroenv deleted the feat/ootb-redirect-plugin branch February 9, 2023 13:27
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.

None yet

5 participants