-
Notifications
You must be signed in to change notification settings - Fork 919
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
feat(client): shorten data keys #1632
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 13453319067Details
💛 - Coveralls |
I'm not with this kind of breaking changes. A lot of naming in this PR is just based on personal habits and doesn't follow a certain pattern, and will make things confusing. A typical example is |
It's natural to have data property shortened without Ref:
So at least any of these listed SHALL NOT BE CONSIDERED as confusing.
You are writing default theme like this yourself so I don't think keys like this needs any bargain. For the rest:
Yes, this is kind of reasonable. The only things new are the following:
And any of theme shall be considered as advanced APIs, and I am not expecting any plugin authors and theme developers to call them unless in very rare edge cases, and users shall never call them. Also as I clearly described in my original PR body:
If you still think thses are not fine, the above four (and only the 4) can be reverted, as they are not be expected to be used commonly anyway. Both @pengzhanbo and I are satisfied with the change, which means even if core refused to merge it, we will make the conversion downstream in ecosystem with |
6c771bc
to
dfa79b8
Compare
Updated:
This should now fit everything in your original comment, none is done with personal taste, everything now has clear motivation and reference. |
This PR renames the
useClientData
withuseData
and shorten data keys.Theme developers are encouraged to use a wrappered
useData
if multiple data are needed in a composable/component:It's can avoid imports burden in components:
Before:
After:
To avoid increasing output, we need to shorten data keys as they can not be minified:
As:
$site
$siteLocale
$theme
$page
$frontmatter
and etc.It's natural to have data property shortened without
$
. This is what the PR does.Besides, the composable names are also shortened to align the changes with data property, users are likely not being confused as we have a long type definition:
Also some composables are fully internal for
vuepress/client
, sinceuseData
was introduced, they are no longer needed:useLayouts
usePageHead
usePageLayout
These APIS are now marked deprecated in favor of
useData()
(AKAuseClientData
)