Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add local echo for notifications in the new room list #5065

Merged
merged 12 commits into from
Jul 31, 2020
Merged

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jul 29, 2020

Design review portion

Is this copy good enough?

image

... then when the user manages to resend everything ...

image


Code review portion

For element-hq/element-web#14302
Fixes element-hq/element-web#14280

This is somewhat reviewable commit-by-commit, though I'd instead recommend reading the included local-echo-dev.md docs and then reviewing the code.

Live demo:
notification-echo mp4

TODO:

  • Wire up a UI for failures
  • Validate/document the class structure

This is somewhat expected to be temporary.
In some cases we're likely to miss the PREPARED sync, so just handle ourselves as ready if we have a client set.
The structure here might need some documentation and work, but overall the idea is that all calls pass through a CachedEcho instance, which are self-updating.
This presumes success as we don't yet have a UI for failures.
The EchoTransaction was wrongly assuming that it knew better than the caller for when the success condition was met, so the echo marking has been left an exercise for the caller. In this case, we mark when we finally receive the sync with the updated rules.

We also have to cancel previous transactions otherwise if the user mashes buttons we could forever show the toast, and that would be bad.
@turt2live turt2live marked this pull request as ready for review July 30, 2020 15:24
@turt2live turt2live requested review from a team July 30, 2020 15:24
@turt2live turt2live removed the request for review from a team July 30, 2020 16:18
@turt2live
Copy link
Member Author

Copy reviewed oob

@turt2live turt2live added the X-Release-Blocker This affects the current release cycle and must be solved for a release to happen label Jul 30, 2020
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an interesting approach, let's give it a try!

I'm not quite sure why you've marked this as needing to be in the RC though...? It seems like a new feature that can merge at any time.

return Array.from(this.toasts.values());
}

public addToast(c: ComponentClass): ToastReference {
Copy link
Collaborator

@jryans jryans Jul 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than storing a class to eventually create, it might be more natural to let the caller pass a normal fully created (but unmounted) component (as a block of JSX most likely), which is then not mounted until needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm not trying to say anything needs to be changed here, just reflecting on what might be more natural to use.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, it's a bit awkward how we create all this stuff. Something to review for toasts in general.

src/utils/Whenable.ts Show resolved Hide resolved
src/utils/Whenable.ts Show resolved Hide resolved
src/stores/local-echo/EchoTransaction.ts Show resolved Hide resolved
src/stores/local-echo/GenericEchoChamber.ts Show resolved Hide resolved
@jryans
Copy link
Collaborator

jryans commented Jul 31, 2020

Since this is relatively isolated to notification state for the moment, it seems safe enough to land and try for the upcoming RC, so I'll merge this now. Please do look over the comments above and consider fixing after the fact where needed.

@jryans jryans merged commit af49639 into develop Jul 31, 2020
@turt2live
Copy link
Member Author

I'm not quite sure why you've marked this as needing to be in the RC though...? It seems like a new feature that can merge at any time.

It fixes a regression where the notifications menu appears to do nothing. We could in theory try and fix it, but notifications are so badly scoped that either the work would be undone by ftue notifications or we'd regress performance. Local echo is just one of the ways out of both problems.

@niquewoodhouse
Copy link
Contributor

lgtm for first iteration

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
X-Release-Blocker This affects the current release cycle and must be solved for a release to happen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New room list: room tile notifications context menu local echo
3 participants