Coder Social home page Coder Social logo

getFlags() , identify(), setTrait(), setTraits() Promise doesn't return a value when resolved. Returns undefined about flagsmith-js-client HOT 5 CLOSED

flagsmith avatar flagsmith commented on July 21, 2024 2
getFlags() , identify(), setTrait(), setTraits() Promise doesn't return a value when resolved. Returns undefined

from flagsmith-js-client.

Comments (5)

kyle-ssg avatar kyle-ssg commented on July 21, 2024 1

getValue / hasFeature is pretty much exactly the same as doing flags[name]. These calls do not interact with the api and are synchronous.

The approach should still be as I mentioned, if we started to resolve a set of flags with these calls it would encourage not using these functions which allow for flag analytics and possibility for any other future features.

I will take a look at these calls as the type file suggests they do resolve with flags, however regardless of this, waiting for the promises to resolve and using flagsmith functions is still probably the way to go.

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 21, 2024

Could I ask what the usecase here is, @Nihir10dec? The idea is to use flagsmith calls such as getValue/hasFeature/getTrait or getState for ssr/isomorphic after the flags and traits have been retrieved (either after onChange or when these promises are resolved)

Iā€™m not really sure what we would want to resolve with if anything. The main thing here is all the gets will at this point have new values.

from flagsmith-js-client.

Nihir10dec avatar Nihir10dec commented on July 21, 2024

So my use case is to get all the Flags at the point where I call the identify() function, so that I retrieve all the flags according to the identified user.
As there are a lot of features and it's a large project where I'm using, calling each features getValue() can be just redundant work.
Hence to retrieve all the flags at just once, I wanted the values returned from the promise.

from flagsmith-js-client.

harenlewis avatar harenlewis commented on July 21, 2024

Hey, @kyle-ssg Any thoughts or suggestions on this?

from flagsmith-js-client.

kyle-ssg avatar kyle-ssg commented on July 21, 2024

Considering the above, the types have been updated in 1.6.2 to indicate that getFlags etc do not resolve with flags

from flagsmith-js-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.