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
fix: non-working hiddenClients
configuration option
#1387
Conversation
|
hiddenClients
configuration option hiddenClients
configuration option
Thanks for the awesome PR! The type check seems to fail, I’ll look into that. :) |
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.
Looks 🌟 awesome 🌟 to me!
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.
Awesome PR! I left a few comments but mostly nit picks and nothing major. Overall its great!
packages/api-reference/src/components/Content/ClientLibraries/ClientSelector.vue
Outdated
Show resolved
Hide resolved
I’ll take care of @amritk’s feedback. ✌️ |
da0903a
to
6e26d27
Compare
@amritk Would you mind to do a 2nd review? 🙌 |
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.
Nice, looks clean 👍🏾
…httpClients() hook, it will only run once (which was probably done due to performance benefits), however this breaks this feature as only the DEFAULT_EXCLUDED_CLIENTS will be applied the first time this runs, and the next time this is meant to run to filter the targets and clients based on the provided user configuration, it is not updated, aka, doesnt work, this is references in scalar#1250. This commit fixes the bug, and retains the performance benefit by caching the target list using watchEffect to only update/recompute the target list when the configuration changes. Next i will implement the inverse of this, and add the ability to specify clients in specific targets to ignore/include, as currently, if you hide "curl", you hide both the curl CLI tool and the php "curl" client, which is probably not intentional.
…s to be hidden. Example: { php: true, // Exclude all PHP clients python: true, // Exclude all Python clients node: ['fetch'], // We expect the "fetch" client to still be available in the "javascript" target. }
@marclave Final review? Let me know if it needs further changes. 👍 |
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.
wow, awesome work @HelgeSverre and @hanspagel for getting this over the finish line!
tested and works GREAT!!!
Problem
Because the "allTargets()..."-code is defined outside of the usehttpClients() hook, it will only run once (which was probably done due to performance benefits), however this breaks this feature as only the DEFAULT_EXCLUDED_CLIENTS will be applied the first time this runs, and the next time this is meant to run to filter the targets and clients based on the provided user configuration, it is not updated, aka, doesnt work, this is references in #1250.
Solution
This commit fixes the bug, and retains the performance benefit by caching the target list using watchEffect to only update/recompute the target list when the configuration changes.
Further improvements
I'm working on an additional fix, that will add the ability to specify clients in specific targets to ignore/include, since the behaviour right now will hide all the "curl"-s instead of only hiding the "php"-curl if you wanted to do so.
Still WIP, but feedback and pointers welcome, struggling a bit with TypeScript errors, even though running the embedding demo with this config works in the browser: