-
Notifications
You must be signed in to change notification settings - Fork 2
refactor/data-manager-communities-channels #143
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
Open
samthomson
wants to merge
187
commits into
main
Choose a base branch
from
refactor/data-manager-communities-channels
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,587
−2,824
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…llelise data fetching
…ay to create channels
…n create a channel
…scape hatch to reload if subs fail
… after we've laoded communities)
…y with non replaceable events
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This gimega PR refactors data fetching throughout the app, into a parent data provider. This allows for some upfront loading, centralised caching, and thus improved performance throughout the app. It's the necessary foundation, to build a real time app on top of.
The goal here was to keep all functionality exactly the same, just move data fetching/updating to one dedicated place. However I did discover quite a few bugs, so fixed them as I went. I also refactored various UI components, to aid reusability and allow for better data flow (eg prop drilling to dumb components over unnecessary hooks). These changes although making for many diffs, are minor imo. The big change is just one: moving all communities data (and derived channels, messages, reactions, permissions, pinned messages, member events etc) up to the data manager provider - plus keeping subscriptions open in order to catch all relevant future events.
It's not perfect, there will likely be some loose ends to tie up, but I'm confident the benefits vastly outweigh any short term hiccups, and we can continue forward with this data architecture to build a nicer UX.
Some things I didn't address:
I chose for now to maintain backwards compatibility - and just change one big thing at a time. Fixing the above will mean starting over in terms of data in our communities. Thus, the sooner the better - and for now treat everything as disposable/ethereal.
I think this is OK, as ultimately we'll want to rewrite everything in a while anyway 😄 to have real private communities and not pseudo privacy/permissions. Now we're in our prototype / proof of concept context, as I see it.
Visually this PR won't look much different. Although if you open another browser/burner to test with, and send messages in a channel you'll see them appear instantly. You can also test creating a new channel and seeing it appear in the other browser. Likewise try creating a community in one browser, then try to join in the other - you'll see the first browser instantly has a membership request, which when approved, lets the other browser see the community in full.
I also added this relay subscription indicator. For sure we may want to design something different, but I thought conveying the connectivity was relevant, as if a subscription drops the user is left out of date but doesn't know it. (it's at least handy for us devs for now...)
What I would like to do later: