Help Center: only check chat availability when user is eligible
Proposed Changes
- Currently, we start a socket connection for every Help Center user to see if they have a chat session. We need to only do that for eligible users to save on Socket connections. All these connections are a waste when we don't render the chat option at all for ineligible users. This PR does that.
Testing Instructions
- Start ETK by going in
apps/editing-toolkitand runningyarn dev --sync. - Open DevTools and go to the Network tab. Filter by WS.
- Using a free user, go to the editor of a sandboxed site.
- You shouldn't see a WebSocket connection to Happychat server.
- Repeat with a premium user, you should see a connection.
This PR modifies the release build for editing-toolkit
To test your changes on WordPress.com, run install-plugin.sh editing-toolkit fix/only-check-chat-avail-for-eligible-users on your sandbox.
To deploy your changes after merging, see the documentation: PCYsg-mMA-p2
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:
Async-loaded Components (~26 bytes added 📈 [gzipped])
name parsed_size gzip_size
async-load-automattic-help-center +122 B (+0.0%) +26 B (+0.0%)
React components that are loaded lazily, when a certain part of UI is displayed for the first time.
Legend
What is parsed and gzip size?
Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.
Generated by performance advisor bot at iscalypsofastyet.com.