Skip to content
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

Prefetch xpost suggestions in Gutenberg #15562

Merged
merged 1 commit into from
Dec 29, 2020
Merged

Conversation

guarani
Copy link
Contributor

@guarani guarani commented Dec 29, 2020

Addresses wordpress-mobile/gutenberg-mobile#2602

This PR prefetches the suggestion data that populates the Xpost suggestion UI. Without this, the user experiences a network delay when first inserting an Xpost suggestion in the block editor.

Expected behavior

RPReplay_Final1609258379.MP4

Note: The throttle introduced in #15558 is a 60 second throttle. This means that the user will still experience the network delay if they wait for more than 60 seconds between opening the editor and inserting an Xpost suggestion.

To test

What you'll need: Two or more WordPress.com sites that are capable of xposting (https://wordpress.com/p2/ can be used to create xpost-capable sites). It's best if you can test with a site that has lots of Xpost suggestions (10 to 20), to ensure that the network delay would be noticeable if present.

Xpost in Gutenberg

  1. Open the block editor
  2. In a Paragraph or any other rich text block, type + and verify that the list of Xpost suggestions is shown immediately (no network delay should be noticeable)
  3. Switch to a different site from within the editor
  4. Type + (or long press the @ toolbar button and select Xpost) and expect the list of suggestions to be shown immediately

Note: There is an issue which @antonis first reported in #15139 (comment) where sites that don't have Xposts suggestions (e.g. non-P2 sites) show the suggestions UI for an instant while the network loads. I didn't address that here because I had difficulty updating the Gutenberg capability when switching between sites while in the the editor. I created wordpress-mobile/gutenberg-mobile#2942 to address this in a later PR.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 29, 2020

You can test the changes on this Pull Request by downloading it from AppCenter here with build number: 39833. IPA is available here. If you need access to this, you can ask a maintainer to add you.

@peril-wordpress-mobile
Copy link

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@guarani
Copy link
Contributor Author

guarani commented Dec 29, 2020

Adding you here @fluiddot since you mentioned you'd like to review/test this. If you're not comfortable reviewing the code, a test is still much appreciated 🙇 and you can just leave a comment instead of an approval.

Copy link
Contributor

@jleandroperez jleandroperez left a comment

Choose a reason for hiding this comment

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

✅ Suggestions delay is gone
✅ Switching to another site also prefetches suggestions

Looks good! :shipit: sir!!

Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

It works perfect, nice work 🎊 !

Minor issue: The only thing I noted which I don't know if it's by design is that when you have only the symbol +/@ in the text input and press backspace it hides the x-post UI but doesn't remove the character from the paragraph block. So if you want to trigger the UI again you have to remove the symbol and input it again.

@guarani
Copy link
Contributor Author

guarani commented Dec 29, 2020

Thank you!

Minor issue: The only thing I noted which I don't know if it's by design is that when you have only the symbol +/@ in the text input and press backspace it hides the x-post UI but doesn't remove the character from the paragraph block. So if you want to trigger the UI again you have to remove the symbol and input it again.

Thanks for reporting that @fluiddot! I think this is a bug that's already in production (tested on iOS and on the Android beta) so I created wordpress-mobile/gutenberg-mobile#2943.

@guarani guarani merged commit 06c24ba into develop Dec 29, 2020
@guarani guarani deleted the gutenberg/xposts-prefetch branch December 29, 2020 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants