Initial structure for shared component views#30216
Conversation
Turn the trivial TextualEvent into a shared component with a separate view model for element web. Args to view model will probably change to be more specific and VM typer needs abstracting out into an interface, but should give the general idea.
Because we used it anyway, we just cheated by getting it from the context
cherry pick edc5e87 from florianduros/storybook
We don't use this in compound, I'm not sure why not. We have our own script that takes the storybook json file and does broadly the same thing. Maybe test-runner didn't exist when we made compound. The received files are uploaded as an artifact so you can download that and put those in as the screenshots, so it's possible, just annoying.
Yeah, don't see why we can't do this.
Yeah, this seems useful so we can actually use the stories as stories. |
|
Have added a base class that simple view models can extend in #30297 (and tweaked the subscribe/unsubscribe interface a bit) |
as this isn't a hook
t3chguy
left a comment
There was a problem hiding this comment.
Lots of js/ts files with no copyright
| this.subs = new ViewModelSubscriptions(this.updateSubscription); | ||
| } | ||
|
|
||
| private updateSubscription = (): void => { | ||
| if (this.subs.listenerCount() > 0) { | ||
| this.eventTileProps.mxEvent.on(MatrixEventEvent.SentinelUpdated, this.onEventSentinelUpdated); | ||
| } else { | ||
| this.eventTileProps.mxEvent.off(MatrixEventEvent.SentinelUpdated, this.onEventSentinelUpdated); | ||
| } | ||
| }; |
There was a problem hiding this comment.
this seems a bit foot-gunny, why not a start/stop esque 2-method approach ooi?
There was a problem hiding this comment.
Yeah, I started to think that actually, I changed it in #30297
Not included in this PR (it's getting large...):
FWIW this uses storybook's test-runner for screenshot tests which is considered deprecated in favour of
@storybook/addon-vitestwhich runs vitest in browser mode, but vistest browser mode doesn't actually support screenshots yet! vitest-dev/vitest#6265 is the bug for it. There's a PR, so it might happen soonish, but not yet. Some people have a workaround usingjest-image-snapshotbut it's ropey. Half an hour before I wrote this message, someone posted a vitest plugin that apparently does it: we could try this.Checklist
public/exportedsymbols have accurate TSDoc documentation.Closes element-hq/wat-internal#397