element-portable/src/components/views/dialogs
kegsay e946674df3
Store refactor: use non-global stores in components (#9293)
* Add Stores and StoresContext and use it in MatrixChat and RoomView

Added a new kind of class:
- Add God object `Stores` which will hold refs to all known stores and the `MatrixClient`. This object is NOT a singleton.
- Add `StoresContext` to hold onto a ref of `Stores` for use inside components.

`StoresContext` is created via:
- Create `Stores` in `MatrixChat`, assigning the `MatrixClient` when we have one set. Currently sets the RVS to `RoomViewStore.instance`.
- Wrap `MatrixChat`s `render()` function in a `StoresContext.Provider` so it can be used anywhere.

`StoresContext` is currently only used in `RoomView` via the following changes:
- Remove the HOC, which redundantly set `mxClient` as a prop. We don't need this as `RoomView` was using the client from `this.context`.
- Change the type of context accepted from `MatrixClientContext` to `StoresContext`.
- Modify alllll the places where `this.context` is used to interact with the client and suffix `.client`.
- Modify places where we use `RoomViewStore.instance` and replace them with `this.context.roomViewStore`.

This makes `RoomView` use a non-global instance of RVS.

* Linting

* SDKContext and make client an optional constructor arg

* Move SDKContext to /src/contexts

* Inject all RVS deps

* Linting

* Remove reset calls; deep copy the INITIAL_STATE to avoid test pollution

* DI singletons used in RoomView; DI them in RoomView-test too

* Initial RoomViewStore.instance after all files are imported to avoid cyclical deps

* Lazily init stores to allow for circular dependencies

Rather than stores accepting a list of other stores in their constructors,
which doesn't work when A needs B and B needs A, make new-style stores simply
accept Stores. When a store needs another store, they access it via `Stores`
which then lazily constructs that store if it needs it. This breaks the
circular dependency at constructor time, without needing to introduce
wiring diagrams or any complex DI framework.

* Delete RoomViewStore.instance

Replaced with Stores.instance.roomViewStore

* Linting

* Move OverridableStores to test/TestStores

* Rejig how eager stores get made; don't automatically do it else tests break

* Linting

* Linting and review comments

* Fix new code to use Stores.instance

* s/Stores/SdkContextClass/g

* Update docs

* Remove unused imports

* Update src/stores/RoomViewStore.tsx

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove empty c'tor to make sonar happy

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2022-10-19 13:07:03 +01:00
..
devtools Reuse empty string & space string logic for event types in devtools (#9218) 2022-08-25 11:08:52 +00:00
security Improve partial translation or to have usage context (#9244) 2022-09-06 13:27:36 +01:00
spotlight Store refactor: use non-global stores in components (#9293) 2022-10-19 13:07:03 +01:00
AddExistingSubspaceDialog.tsx fix merge conflict resolution issue 2021-07-29 15:24:42 +01:00
AddExistingToSpaceDialog.tsx Space panel accessibility improvements (#9157) 2022-08-10 12:14:54 +00:00
AnalyticsLearnMoreDialog.tsx Remove dead code (#9035) 2022-07-11 07:52:44 +02:00
AppDownloadDialog.tsx Improve partial translation or to have usage context (#9244) 2022-09-06 13:27:36 +01:00
AskInviteAnywayDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
BaseDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
BetaFeedbackDialog.tsx Improve link buttons and inline link buttons styling (#8238) 2022-06-29 22:37:34 +00:00
BugReportDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
BulkRedactDialog.tsx Run a minor code quality checker over the repo (#8524) 2022-05-09 22:52:05 +00:00
ChangelogDialog.tsx Move from browser-request to fetch (#9345) 2022-10-12 18:59:07 +01:00
ConfirmAndWaitRedactDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
ConfirmRedactDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ConfirmSpaceUserActionDialog.tsx Delete groups (legacy communities system) (#8027) 2022-03-22 23:07:37 +00:00
ConfirmUserActionDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
ConfirmWipeDeviceDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
CreateRoomDialog.tsx Replace MSC3244 support with in-client room version checking (#9018) 2022-07-08 00:32:38 -06:00
CreateSubspaceDialog.tsx Replace MSC3244 support with in-client room version checking (#9018) 2022-07-08 00:32:38 -06:00
CryptoStoreTooNewDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
DeactivateAccountDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
DevtoolsDialog.tsx Move widget screenshots to devtools dialog instead of labs 2022-05-06 13:05:01 -06:00
EndPollDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ErrorDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ExportDialog.tsx Run a minor code quality checker over the repo (#8524) 2022-05-09 22:52:05 +00:00
FeedbackDialog.tsx Add additional metadata to feedback submitted through spotlight dialog (#9024) 2022-07-11 12:00:40 +02:00
ForwardDialog.tsx Correct accessibility labels for unread rooms in spotlight (#9003) 2022-07-11 11:34:23 +00:00
GenericFeatureFeedbackDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
HostSignupDialog.tsx Don't unnecessarily persist the host signup dialog (#9043) 2022-07-11 16:50:13 -04:00
HostSignupDialogTypes.ts Use & enforce snake_case naming convention on config.json settings (#8062) 2022-03-18 10:12:36 -06:00
IDialogProps.ts Fix Dialog/Modal types defn 2021-06-07 11:06:30 +01:00
IncomingSasDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
InfoDialog.tsx Step 3.2: Stop using getComponent in code 2022-03-28 14:02:31 -06:00
IntegrationsDisabledDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
IntegrationsImpossibleDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
InteractiveAuthDialog.tsx Automatically log in after registration (#8654) 2022-05-20 19:14:17 +02:00
InviteDialog.tsx Move from browser-request to fetch (#9345) 2022-10-12 18:59:07 +01:00
InviteDialogTypes.ts Extract start DM logic to a helper file (#8317) 2022-04-14 16:52:12 +01:00
KeySignatureUploadFailedDialog.tsx Run a minor code quality checker over the repo (#8524) 2022-05-09 22:52:05 +00:00
LazyLoadingDisabledDialog.tsx Auto fix 2021-10-22 17:23:37 -05:00
LazyLoadingResyncDialog.tsx Auto fix 2021-10-22 17:23:37 -05:00
LeaveSpaceDialog.tsx Fix button border color of LeaveSpaceDialog (#8010) 2022-03-10 07:52:09 +00:00
LogoutDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ManageRestrictedJoinRuleDialog.tsx Fix Manage Restricted Join Rule Dialog for Spaces (#7208) 2021-11-29 09:23:25 +00:00
ManualDeviceKeyVerificationDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
MessageEditHistoryDialog.tsx Apply corrections identified by SonarQube (#8457) 2022-05-03 22:04:37 +01:00
ModalWidgetDialog.tsx Element Call video rooms (#9267) 2022-09-16 11:12:27 -04:00
ModuleUiDialog.tsx Support a module API surface for custom functionality (#8246) 2022-07-05 12:26:44 -06:00
QuestionDialog.tsx Live location share - handle insufficient permissions in location sharing (PSG-610) (#9047) 2022-07-13 10:55:08 +00:00
RegistrationEmailPromptDialog.tsx Remove Countly analytics integration (#7808) 2022-02-15 16:58:30 +00:00
ReportEventDialog.tsx Add an option to ignore (block) a user when reporting their events (#8471) 2022-05-18 16:20:55 +00:00
RoomSettingsDialog.tsx Add Element Call room settings (#9347) 2022-10-07 18:10:17 +00:00
RoomUpgradeDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
RoomUpgradeWarningDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ScrollableBaseModal.tsx Make everything use the KeyBindingManager (#7907) 2022-02-28 16:05:52 +00:00
ServerOfflineDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
ServerPickerDialog.tsx Spike AXE A11Y testing in Cypress (#9111) 2022-08-01 08:31:14 +01:00
SeshatResetDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
SessionRestoreErrorDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
SetEmailDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
ShareDialog.tsx Fix soft crash around inviting invalid MXIDs in start DM on first message flow (#9281) 2022-09-16 09:03:17 +01:00
SlashCommandHelpDialog.tsx Auto fix 2021-10-22 17:23:37 -05:00
SlidingSyncOptionsDialog.tsx Move from browser-request to fetch (#9345) 2022-10-12 18:59:07 +01:00
SpacePreferencesDialog.tsx Step 8.5: Move some space settings dialog construction 2022-03-28 14:02:31 -06:00
SpaceSettingsDialog.tsx type Actions (#7862) 2022-02-22 10:04:27 +00:00
StorageEvictedDialog.tsx Remove Piwik support (#8835) 2022-06-14 17:51:51 +01:00
TermsDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
TextInputDialog.tsx Implement MSC3575: Sliding Sync (#8328) 2022-09-07 15:42:39 +00:00
UntrustedDeviceDialog.tsx Standardise sane capitalisation in verification modal (#9198) 2022-08-17 14:05:20 +01:00
UploadConfirmDialog.tsx Task - replace img icons with svg components (#8963) 2022-07-06 13:29:26 +02:00
UploadFailureDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
UserSettingsDialog.tsx Device Manager - add new labsed session manager screen (PSG-636) (#9119) 2022-08-08 13:51:00 +00:00
UserTab.ts Device Manager - add new labsed session manager screen (PSG-636) (#9119) 2022-08-08 13:51:00 +00:00
VerificationRequestDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
WidgetCapabilitiesPromptDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00
WidgetOpenIDPermissionsDialog.tsx Step 1: Remove all usage of @replaceableComponent 2022-03-28 14:02:31 -06:00