-
Notifications
You must be signed in to change notification settings - Fork 51
Implement RTK Query approach for fetching wpcom sites #2132
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
epeicher
wants to merge
22
commits into
trunk
Choose a base branch
from
stu-1035-cta-for-users-without-sites-displays-before-sites-are-loaded
base: trunk
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.
+434
−454
Open
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c4efc6c
Implement RTK Query approach for fetching wpcom sites
epeicher 7d8fd66
Use the new hook and update loading conditions
epeicher ba89f0d
Rename function name for clarity
epeicher ee7ea22
Remove use-fetch-wpcom-sites and update imports
epeicher afd3fbf
Fix tests
epeicher d7113b1
Refetch sites when opening the sites modal instead of using an effect
epeicher 9a6f74f
Do not fetch sites on mount
epeicher 7d0b2a5
Merge branch 'trunk' of github.com:Automattic/studio into stu-1035-ct…
epeicher b09206b
Update files after merge
epeicher 427d3ab
Infer the SitesEndpointSite type from the schema
epeicher 63cc6b8
Remove unnecessary effect on sites modal
epeicher 48ffd67
Merge branch 'trunk' of github.com:Automattic/studio into stu-1035-ct…
epeicher 7e1bbdb
Unify Publish site button in one component with a redirect prop
epeicher c86048c
Fix comment wording
epeicher b134968
Remove isBusy from the publish site button
epeicher 5610e0e
Merge branch 'trunk' of github.com:Automattic/studio into stu-1035-ct…
epeicher 5079edf
Move fetching sites logic to sites modal selector
epeicher 99a6b55
Add and remove comments
epeicher 5cfc0f2
Refactor connected-sites mutation to accept an id and fetch the sites
epeicher 8fa10dd
Revert "Refactor connected-sites mutation to accept an id and fetch t…
epeicher 61e8a4b
Use the more declarative refetchOnMount instead of an effect on pull-…
epeicher a2fd40a
Merge branch 'trunk' of github.com:Automattic/studio into stu-1035-ct…
epeicher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I suggest moving more of this logic to
src/stores/sync/connected-sites.tsby updating theconnectSitemutation like so:This would allow us to shorten this hook significantly:
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.
Thanks for the suggestion, I will work on that
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.
I have been working on this, but I have found that this will trigger an additional call to the
/me/sitesendpoint when theconnectSitemutation is used from the add-site and from the ContentTabSync handleConnect, where they already have the site, so I am not sure we are improving here.What do you think about tackling this specific refactor as a follow-up and progressing with the current changes?