Unleash / unleash-proxy-client-js

A browser client that can be used together with the unleash-proxy.
Apache License 2.0
44 stars 46 forks source link

Add support to provide namePrefix and tags for filtering #165

Closed omnichronous closed 2 months ago

omnichronous commented 12 months ago

Describe the feature request

Thank you for your work Unleash team. Is it possible to port the functionality from https://github.com/Unleash/unleash-client-node/pull/237 into this SDK too?

Background

I have a codebase with multiple projects that sometimes share feature toggles and sometimes not. I'd like to be able to use tags in the Unleash Admin to designate which project uses which toggles and then in each project fetch only those toggles that are relevant to it.

Solution suggestions

No response

sighphyre commented 11 months ago

Hey @omnichronous, this probably isn't on our radar right now. You're more than welcome to take a stab at a PR but we have other high priority changes that we're focusing on.

What problem is this actually causing for you? Are you trying to reduce network overhead here?

omnichronous commented 11 months ago

Thanks for your response @sighphyre. Yeah reducing network overhead is part of it, and another part is security - the same logic as returning only the currently enabled toggles when the client does a fetch.

What I'm really trying to do is integrate Unleash with my analytics solution. I want to create a "set it and forget it" mechanism to include the Unleash state in every event that's reported to my analytics tool. When that difference between 10 and 20 toggles gets multiplied by thousands and thousands of events it starts to have a real impact. That's why I'd like a way to filter out some of the toggles on the client side.

Even just getting the tags in the client would solve this for me, but I figured porting this functionality from the other SDK would be easier.

sighphyre commented 10 months ago

@omnichronous Ah, you have a fairly unusual use case here. Have you seen this: https://docs.getunleash.io/reference/impression-data that's usually how I would recommend approaching that problem, but that probably won't work if you need the entire snapshot.

What you're saying makes sense and we're very open to adding the feature but we have quite a lot of high priority things that we need to tackle before we focus on this. We'd be more than open to accepting a PR if you need it and you're willing to give it a shot?

Aaronius commented 2 months ago

Related to this, is there a way to only request toggles for a specific project? It doesn't look like it.

ivarconr commented 2 months ago

Related to this, is there a way to only request toggles for a specific project? It doesn't look like it.

Yes, as long as you use a project specific token together with the Unleash Frontend API or the Unleash Edge you will only get toggles for that project.

ivarconr commented 2 months ago

I am closing this as you can achieve the same goal with scoped API tokens.