Delayed events (Futures) / MSC4140 for call widget#12714
Delayed events (Futures) / MSC4140 for call widget#12714robintown merged 1 commit intomatrix-org:developfrom AndrewFerr:msc4140-widgets
Conversation
|
I'll take this out of draft once the dependent js-sdk PR is merged. |
|
Note that the Static Analysis failure is also happening on develop. |
toger5
left a comment
There was a problem hiding this comment.
Oh forgot how easy this is since all the work is done in the widget-api repo.
This is just the matrix part!
I am positive on this, bu Just to get you confirmation: also the capability checks are done in the widget-api right?
Yes they are, in src/ClientWidgetApi.ts |
|
The latest batch of commits is just a rebase on the |
| stateKey?: string | null, | ||
| targetRoomId?: string, | ||
| stateKey: string | null = null, | ||
| targetRoomId: string | null = null, |
There was a problem hiding this comment.
why the changes from undefined to null? I think in general intend want to move in the other direction.
There was a problem hiding this comment.
It's to match the signature of WidgetApi#sendEvent, which uses string | null = null for these arguments.
It also struck me as dangerous to allow stateKey to be undefined or null when there was only a !== null check on it, and felt that restricting both parameters to just null made things simpler.
There was a problem hiding this comment.
ok, it would probably be good to change the widget api at some point but that needn't be today
|
|
||
| /** | ||
| * @experimental Part of MSC4140 & MSC4157 | ||
| */ |
There was a problem hiding this comment.
Could this have some doc on the params please? For instance, I'm at a loss as to what parentDelayId might be.
Also, what would it mean to pass null to delay here?
There was a problem hiding this comment.
Also, this is quite a lot of params for a function. May want to consider making it an object (although equally I guess we want it consistent with the rest of the API).
There was a problem hiding this comment.
This implements WidgetDriver#sendDelayedEvent, which is present as of v1.8.0 & is where the documentation is. I'll add a @see here to link to it.
Also, making this take an object would require updating the widget-api. It doesn't take an object for the sake of avoiding adding a new type in case the whole "parent" idea gets dropped.
| await expect(driver.sendDelayedEvent(2000, null, EventType.RoomMessage, {})).resolves.toEqual({ | ||
| roomId, | ||
| delayId: "id", | ||
| }); |
There was a problem hiding this comment.
Could do with an assertion that the client function is actually called in the way you think it should be called, otherwise this isn't testing what it claims to (same for the rest of these).
|
|
||
| beforeEach(() => { | ||
| driver = mkDefaultDriver(); | ||
| jest.spyOn(SdkContextClass.instance.roomViewStore, "getRoomId").mockReturnValue(roomId); |
There was a problem hiding this comment.
Please remember to always call restoreAllMocks() in an afterEach() if you mock or spy on anything, otherwise your mocks will bleed into other tests.
There was a problem hiding this comment.
It turns out I don't need this after all, so I'll just get rid of it.
|
I've rebased + squashed the commits to hide some of the churn that built up over time, and also wrote a more descriptive commit message. |
Depends on:
Signed-off-by: Andrew Ferrazzutti andrewf@element.io
Checklist
public/exportedsymbols have accurate TSDoc documentation.