-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Odie][PoC][DRAFT] Standalone Odie client #84069
base: trunk
Are you sure you want to change the base?
[Odie][PoC][DRAFT] Standalone Odie client #84069
Conversation
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~613 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~5335 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~4937 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
function omit( obj, fields ) { | ||
const newObj = { ...obj }; | ||
for ( const field of fields ) { | ||
if ( newObj.hasOwnProperty( field ) ) { | ||
delete newObj[ field ]; | ||
} | ||
} | ||
return newObj; | ||
} |
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.
This is the result of removing lodash
library. It was included as a dependency in order to load it's omit
function
const { isMinimized } = useSelect( ( select ) => { | ||
const store = select( HELP_CENTER_STORE ) as HelpCenterSelect; | ||
return { | ||
show: store.isHelpCenterShown(), | ||
isMinimized: store.getIsMinimized(), | ||
initialRoute: store.getInitialRoute(), | ||
}; | ||
}, [] ); | ||
|
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.
Removed the Help Center dependency
import MinimizeIcon from 'calypso/assets/images/odie/minimize-icon.svg'; | ||
import WapuuAvatar from 'calypso/assets/images/odie/wapuu-squared-avatar.svg'; | ||
import WapuuThinking from 'calypso/assets/images/odie/wapuu-thinking.svg'; |
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.
These assets should be moved inside the package
import Gravatar from 'calypso/components/gravatar'; | ||
import { getCurrentUser } from 'calypso/state/current-user/selectors'; |
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.
We need to inject this as a component to represent the user's profile. It ca be a new prop for Odie,
<OdieProvider
...
...
userAvatarComponent={<Gravatar... />}
>
{ children }
<OdieProvider/>
Proposed Changes
This is just a draft where I am trying to create a new package so we can use this client that already connects with our
ai-services
.We still need to remove two dependencies (and probably delete the code, I think we don't need it as I did it thinking around Jetpack). That code lives on
odie/query/index.ts
Lastly, we should inject the User's avatar or display image. Right now its a Calypso dependency using Gravatar component.
Addressing those two things, we have almost decoupled the client from Calypso, and next steps would be to generate a package and add it as a dependency to Calypso or whatever.
All the files in the
utils
folder are added as a copy from elsewhere in calypso.DISCLAIMER
Please bear in mind that the current Odie client code is going to be live and actively used next Monday, do not merge if we are not fully sure that the changes we are doing are working.
Testing Instructions
Pre-merge Checklist