Skip to content

[BUG] useFeature returns false directly when the return datafile indicates true #304

Open
@yslkmart

Description

@yslkmart

Is there an existing issue for this?

  • I have searched the existing issues

SDK Version

"@optimizely/react-sdk": "^3.2.2",

Current Behavior

I'm using useFeature hook to get the feature flag and later use react query to call diff endpoint per feature flag setting.

When the component renders, I get isEnabled returned from the hook as false but later on all true. The setting on the Optimizely end for the flag is true and I can see it from the returned datafile as well.

I also tried to use clientReady, but it was true ever since component rendered.

Is this the default behaviour? I'm expecting isEnabled to be undefined while the client sdk is processing the datafile to get the isEnabled state.

Thanks,

Expected Behavior

useFeature hook should return undefined while processing

Steps To Reproduce

just use useFeature hook for a specific feature

React Framework

"react": "^18.3.1",

Browsers impacted

No response

Link

No response

Logs

No response

Severity

No response

Workaround/Solution

No response

Recent Change

No response

Conflicts

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions