-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(hydrate): support server side rendering of components with listen…
…er (#5877)
- Loading branch information
1 parent
bb2e04f
commit 2c5b7f8
Showing
6 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
3 changes: 3 additions & 0 deletions
3
test/end-to-end/src/declarative-shadow-dom/dsd-listen-cmp.css
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:host { | ||
display: block; | ||
} |
25 changes: 25 additions & 0 deletions
25
test/end-to-end/src/declarative-shadow-dom/dsd-listen-cmp.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, Element, h, Host, Listen } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'dsd-listen-cmp', | ||
styleUrl: 'dsd-listen-cmp.css', | ||
shadow: true, | ||
}) | ||
export class MyWhateverComponent { | ||
@Element() hostElement: HTMLSlotElement; | ||
private slotRef: HTMLSlotElement; | ||
|
||
@Listen('keydown', { capture: true }) // Crashes, incorrect binding in hydrate index.js | ||
handleKeyPress(e: CustomEvent): void { | ||
e.stopPropagation(); | ||
console.log(this.slotRef); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<slot ref={(el: HTMLSlotElement) => (this.slotRef = el)}></slot> | ||
</Host> | ||
); | ||
} | ||
} |
This file contains 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
This file contains 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