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(html): bind function only once #921

Merged
merged 4 commits into from
Mar 18, 2022
Merged

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Mar 17, 2022

also renamed HTMLToJSX to HTMLTemplate, as the JSX part is an implementation detail IMO

@Haroenv Haroenv requested a review from sarahdayan March 17, 2022 16:39
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 17, 2022

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 53fcbcd:

Sandbox Source
algolia/autocomplete Configuration
algolia/autocomplete Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
algolia/autocomplete Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

Copy link
Member

@sarahdayan sarahdayan left a comment

Choose a reason for hiding this comment

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

Good call on the single binding 👍

@@ -37,4 +37,4 @@ export type AutocompleteRenderer = {
Fragment: PragmaFrag;
};

export type HTMLToJSX = typeof htm;
export type HTMLTemplate = typeof htm;
Copy link
Member

Choose a reason for hiding this comment

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

Better naming indeed, however this isn't really a "template" compared to the existing Template type in Autocomplete, it's more of a template transformer or such. So maybe HTMLTemplateTransformer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure the distinction is required. It's a "tagged template" which allows the user to write html, so HTMLTemplate describes that enough IMO. Similarly how we call it a widget, and not a widget factory

@sarahdayan
Copy link
Member

The few extra bytes are caused by htm but it's really minimal. We can document how to get rid of it in production for end users by setting up babel-plugin-htm.

@Haroenv Haroenv merged commit d29510b into feat/html-templating Mar 18, 2022
@Haroenv Haroenv deleted the feat/html-native branch March 18, 2022 14:00
sarahdayan pushed a commit that referenced this pull request Mar 18, 2022
* feat(html): create binding only once

* rename to HTMLTemplate

* format document

* update size
sarahdayan pushed a commit that referenced this pull request Mar 18, 2022
* feat(html): create binding only once

* rename to HTMLTemplate

* format document

* update size
sarahdayan pushed a commit that referenced this pull request Mar 31, 2022
* feat(html): create binding only once

* rename to HTMLTemplate

* format document

* update size
sarahdayan pushed a commit that referenced this pull request Apr 6, 2022
* feat(html): create binding only once

* rename to HTMLTemplate

* format document

* update size
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.

3 participants