-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Integrate GutenbergKit remote editor asset caching #24639
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
base: trunk
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
GutenbergKit.EditorViewController.warmup() | ||
GutenbergKit.EditorViewController.warmup( | ||
configuration: blog.flatMap(EditorConfiguration.init(blog:)) ?? .default | ||
) |
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 can move/copy this code to "warm up" the GBK editor after switching sites, which pre-fetches the remote editor assets.
editorAssetsEndpoint.appendPathComponent("editor-assets") | ||
self.editorAssetsEndpoint = editorAssetsEndpoint | ||
} | ||
} |
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 if statement is new. The rest are moved from the view controller initializer above.
siteApiNamespace.append("sites/\(siteId)") | ||
} else { | ||
siteApiNamespace.append("sites/\(siteDomain)") | ||
} |
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 lied. This if statement is also changed. The siteApiNamespace
should not be ["sites/<site-id>", "sites/<mysite.wordpress.com>"]
, right? It should contain either the id or the domain?
Here is the original code, for easier review:
if isWPComSite {
if let siteId {
siteApiNamespace.append("sites/\(siteId)")
}
siteApiNamespace.append("sites/\(siteDomain)")
}
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.
Oh wait... I see the code comment now. I'll revert this change.
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.
Correct, we need to retain this. Third-party blocks can utilize either namespace. So, we need both for proper matching, otherwise we may mistakenly add a duplicative namespace to a path already containing a namespace.
|
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 works well from my testing. 🎉 Aside from the noted GBK release requirement, this seems good to merge.
//.package(url: "https://github.com/wordpress-mobile/GutenbergKit", from: "0.3.0"), | ||
.package(path: "../../../GutenbergKit"), |
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.
Friendly note: we need to replace the local path with a new GBK release before merging this PR.
FYI I have a open wordpress-mobile/GutenbergKit#151 for documenting and automating the GBK release process.
siteApiNamespace.append("sites/\(siteId)") | ||
} else { | ||
siteApiNamespace.append("sites/\(siteDomain)") | ||
} |
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.
Correct, we need to retain this. Third-party blocks can utilize either namespace. So, we need both for proper matching, otherwise we may mistakenly add a duplicative namespace to a path already containing a namespace.
Description
Close CMM-509. This PR uses wordpress-mobile/GutenbergKit#148.
To try it out locally:
Testing instructions