Closed swissspidy closed 3 years ago
Wonder if we should do this as the same time https://github.com/google/web-stories-wp/issues/6634
Getting rid of these should do done at the same time
As this is a WordPress / gutenberg context, we should reuse dropdowns and search for gutenberg.
Yeah I suppose we can, but in a separate PR. Will move it on the board & marked as blocked by this one.
Assigning to myself since I've been looking into this a bit locally already and have something shareable soon.
Re-sharing from Slack:
After some initial work to remove dependencies, I got the size of web-stories-block.js
down from 2.9 MB (!) to less than 70 KB (!!!)
Both Search Stories and Search By Author have transparent backgrounds in their pulldown-type displays:
Feature Description
When we originally created the new Web Stories block, we purposely re-used existing components from the dashboard and design system so we could ship this fast and iterate on it later.
That made it easy for us to have the same design as in the dashboard and to display stories properly using the
<CardPreview>
/<PreviewPage>
component without having to re-invent the wheel.Now that we're switching to displaying posters instead of actual previews in the dashboard (#5147), it is a good time to cut ties with these packages.
Not only that, it is also a good opportunity to simplify the block's code in other ways.
What I have in mind in total:
ConfigProvider
We can simply access the
window.webStoriesBlockSettings
globaluseUserApi
anduseStoryApi
intouseApi
useApi
, usecreateContext
from@wordpress/element
instead of from design system.@wordpress/components
in the story picker instead of components from dashboard and design-system.edit.css
instead of styled componentstotalStoriesByStatus
andreshapeStoryObject
useApi
completely in favor of some simpler callbacks & effects.wp.data.select('core').getAuthors()
instead offetchAuthors
wp.data.select('core').getEntityRecords('postType', 'web-story')
instead offetchStories
Currently not possible due to https://core.trac.wordpress.org/ticket/53656 / https://github.com/WordPress/gutenberg/issues/33420 - unless we remove our custom namespace.
Once this is all done there should be no more dependencies to the dashboard and the design system package, nor styled-components, and the block bundle size should be significantly smaller.
Alternatives Considered
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
Implementation Brief