-
-
Notifications
You must be signed in to change notification settings - Fork 590
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
Change Store.save()
to return a Promise
#3221
Change Store.save()
to return a Promise
#3221
Conversation
The only implementation of this is an async function, but I can’t await it because the interface hides the return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@texuf thanks for your contribution!
I think I'm missing some context on this. Is there a particular problem you are trying to solve?
I don't think IStore.save
is meant to be used from outside the js-sdk (though I could be wrong on this; it's not an area I'm terribly familiar with). My understanding is that it is automatically called from sync.ts
as part of the /sync
loop, so I'm curious as to your usecase.
I'm also not sure that it matters that we don't wait for the promise to complete - there's not much we can do with the knowledge in any case.
@t3chguy I see you've labelled this as a breaking change, but we're changing a method that returned |
@richvdh typescript strict mode can get unhappy about this scenario |
I am writing tests where I'd like to verify that the saved sync interacts as I would expect with my application code.
Then I go on to create a new matrix client with the same credentials (simulating a browser refresh) and verify that the saved sync is loaded and correctly populates my ui If I don't wait for the save to complete, I have unreliable tests because I don't know when the async operation has completed. I think there will be instances in the future where I will want to ensure data is persisted before performing a user action, but that is speculation, the main use case is for writing reliable tests. |
Store.save()
to return a Promise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fair. Thanks for the explanation!
Can anyone help me with this downstream test error?
not sure what do here. |
Ah i see, a previous test failed, still not sure if this is on me
|
Yeah, I don't understand this either. I've asked for help from the rest of the team but it's Friday evening now. |
Looks like a WYSIWYG test is flaky |
@t3chguy do you think we could try the merge queue again? |
This does seem to be causing an actual failure, unfortunately |
possibly the problem is that we are now waiting for |
Thanks for looking into it. I will see if I can figure it out later tonight. |
I don't see much difference between my run and a successful one, the output is pretty rough to look at. I created a PR for the only thing I could find: element-hq/element-web#25061 |
It absolutely is. I think this is mostly a result of our jest configuration; #3269 should improve that for the js-sdk, and I'll replicate it for the other projects soon. (Though also, the failing test uses matrix-mock-request, which is... crap.) However, on closer inspection of the logs from the failed run, it seems like the failure mode is already known, so I'm going to mash the merge button again. Sorry for the run-around on this. |
…mpl (matrix-org#3221) The only implementation of this is an async function, but I can’t await it because the interface hides the return type. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Change `Store.save()` to return a `Promise` ([\matrix-org#3221](matrix-org#3221)). Contributed by @texuf. * Add typedoc-plugin-mdn-links ([\matrix-org#3292](matrix-org#3292)). * Annotate events with executed push rule ([\matrix-org#3284](matrix-org#3284)). Contributed by @kerryarchibald. * Element-R: pass device list change notifications into rust crypto-sdk ([\matrix-org#3254](matrix-org#3254)). Fixes element-hq/element-web#24795. Contributed by @florianduros. * Support for MSC3882 revision 1 ([\matrix-org#3228](matrix-org#3228)). Contributed by @hughns. * Fix screen sharing on Firefox 113 ([\matrix-org#3282](matrix-org#3282)). Contributed by @tulir. * Retry processing potential poll events after decryption ([\matrix-org#3246](matrix-org#3246)). Fixes element-hq/element-web#24568. * Element-R: handle events which arrive before their keys ([\matrix-org#3230](matrix-org#3230)). Fixes element-hq/element-web#24489.
The only implementation of this is an async function, but I can’t await it because the interface hides the return type.
signed-off-by austin ellis austin@hntlabs.com
Type: defect
Here's what your changelog entry will look like:
🚨 BREAKING CHANGES
Store.save()
to return aPromise
(#3221). Contributed by @texuf.