Page MenuHomePhabricator

[web] Wrap modals with `WebEditUserAvatarProvider`
ClosedPublic

Authored by atul on Jun 20 2023, 6:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 1:44 PM
Unknown Object (File)
Sat, Nov 23, 1:44 PM
Unknown Object (File)
Sat, Nov 23, 1:08 PM
Unknown Object (File)
Sat, Nov 23, 1:08 PM
Unknown Object (File)
Sat, Nov 23, 3:56 AM
Unknown Object (File)
Wed, Nov 13, 4:43 AM
Unknown Object (File)
Sat, Nov 9, 6:45 PM
Unknown Object (File)
Sat, Nov 9, 6:07 PM
Subscribers

Details

Summary

We want to be able to access eg setUserAvatar from EmojiAvatarSelectionModal, however, we can't access the context since the modal is being rendered outside of "mainContent".

We're only wrapping modals with WebEditUserAvatarProvider when the user is logged in.


Depends on D8268

Test Plan

Able to access EditUserAvatarContext from EmojiAvatarSelectionModal as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

web/app.react.js
176–179 ↗(On Diff #27916)

Not sure if we ever have modals when logged out, but want to keep this a "noop refactor" and leave things as is.

atul requested review of this revision.Jun 20 2023, 6:20 PM

Adding @ginsu since he introduced the equivalent provider on native.

This makes sense, but one question inline

web/app.react.js
186 ↗(On Diff #27916)

Why didn't we wrap the WebEditUserAvatarProvider right under here? I know in the description it says:

We're only wrapping modals with WebEditUserAvatarProvider when the user is logged in.

I feel like wrapping WebEditUserAvatarProvider under here would be more simple, but are there other advantages to your current implementation that I might be overlooking?

This revision is now accepted and ready to land.Jun 22 2023, 3:58 PM
web/app.react.js
186 ↗(On Diff #27916)

Jotted down my reasoning here: https://phab.comm.dev/D8249?id=27866#inline-53090

If we were to move it under MenuProvider, isn't it possible that eg userAvatarSaveInProgress could be incorrect if the user logged out and back in? Thought it made sense to have a new instance of WebEditUserAvatarProvider for each user session?

CC @ashoat to double check my assumptions/reasoning here

This revision was landed with ongoing or failed builds.Jun 23 2023, 2:07 PM
This revision was automatically updated to reflect the committed changes.

Jotted down my reasoning here: https://phab.comm.dev/D8249?id=27866#inline-53090

Thanks for linking this, I read through it, and your assumptions/reasoning makes sense to me. Sorry I missed this earlier