fix(vue-compat): make renderCompat tolerate React-style JSX#7029
Draft
aymeric-giraudet wants to merge 1 commit into
Draft
fix(vue-compat): make renderCompat tolerate React-style JSX#7029aymeric-giraudet wants to merge 1 commit into
aymeric-giraudet wants to merge 1 commit into
Conversation
`instantsearch-ui-components` ships React-style functional components
that the recommendation widgets render via the augmented JSX `h`. Three
gaps in the existing compat layer made shared factories crash or render
empty markup in Vue:
- The augmented `h` destructured `propsWithClassName` directly, so any
JSX child rendered with `null` props (e.g. `<Fragment>x</Fragment>`)
threw `Cannot destructure property 'className' of null`. Vue 2 and
Vue 3 now both guard the destructure against `null`.
- Vue 2 had no native `Fragment` and the augmented `h` didn't translate
React-style `onClick`/`onAuxClick` props into Vue 2's `on: { click,
auxclick }` event API, so default `EmptyComponent`s crashed and event
handlers fell through as literal HTML attributes (`onclick="() => {…}"`).
Adds a Vue 2 `Fragment` shim and remaps React-style handlers.
- In Vue 3, children for functional components go to `slots.default`
rather than `props.children`, so shared components like `Button` that
read `{children}` rendered as empty `<button><!----></button>`.
Mirrors the Vue 2 behavior by forwarding `children` as a prop for
function tags.
No widget changes; this only makes the compat layer ready for the
shared UI factories used by the upcoming Vue recommendation/chat ports.
2 tasks
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes.
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #7020 (port-widget skill improvements).
Summary
Foundational compat fixes that the upcoming Vue recommendation/chat ports need. No widget changes.
Test plan
Next in the stack: common test infrastructure refactor.