-
Notifications
You must be signed in to change notification settings - Fork 86
feat: get capabilities from site info #6902
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
Conversation
|
This pull request adds or modifies JavaScript ( |
ec3fb7d to
6cae54f
Compare
6cae54f to
0b53d6d
Compare
| const accounts = includeCapabilities | ||
| ? ((await api.listAccountsForUser()) as MinimalAccount[] | null) | ||
| : ((await api.listAccountsForUser( | ||
| // @ts-expect-error(ndhoule): This is an unpublished, internal querystring parameter | ||
| { minimal: 'true' }, | ||
| )) as MinimalAccount[] | null) |
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.
Discussed in Slack (internal link). In summary:
- We had previously changed this to
?minimal=trueand found that it had a very significant performance impact. To be fair, that was affecting all netlify-cli commands' startup times, evennetlify help. - So, this will likely add up to many seconds of additional boot time to non-CLI code paths (those going through
@netlify/dev, i.e. currently@netlify/vite-pluginand@netlify/nuxt). - It's a bit misleading for future us here that
includeCapabilitiesresults in computing and including several additional fields, one of which iscapabilities. I think we can solve this easily with a different name. - Let's leave a comment here about how the perf difference is huge, to try to avoid future regressions?
| const accounts = includeCapabilities | ||
| ? ((await api.listAccountsForUser()) as MinimalAccount[] | null) | ||
| : ((await api.listAccountsForUser( | ||
| // @ts-expect-error(ndhoule): This is an unpublished, internal querystring parameter | ||
| { minimal: 'true' }, | ||
| )) as MinimalAccount[] | null) |
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.
As Nathan called out, this type isn't accurate, right? We used to have an Account type, do we still have it? or does api.listAccountsForUser() maybe return the right type out of the box?
| siteFeatureFlagPrefix: string | ||
| token: string | ||
| extensionApiBaseUrl: string | ||
| includeAccountCapabilities?: boolean |
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.
(see below) maybe something like:
| includeAccountCapabilities?: boolean | |
| includeFullAccountInfo?: boolean |
or (note it's negated):
| includeAccountCapabilities?: boolean | |
| useMinimalAccountsApi?: boolean |
|
Don't need this one anymore |
🎉 Thanks for submitting a pull request! 🎉
Summary
To support the check here https://github.com/netlify/primitives/pull/577/changes
For us to review and ship your PR efficiently, please perform the following steps:
we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
something that`s on fire 🔥 (e.g. incident related), you can skip this step.
your code follows our style guide and passes our tests.
A picture of a cute animal (not mandatory, but encouraged)