Flag Evaluation Flow

FlagSync evaluates flags using the same logic flow across SDKs:

1

Is the SDK ready?

If not, the SDK returns the defaultValue (e.g., false) or control string.

// Before SDK is ready

const one = client.flag('flag-one', false); // false (defaultValue)

const two = client.flag('flag-two'); // "control"

await client.waitForReady();

Client-side SDKs can bootstrap via LocalStorage or from an initial flag set, using those values until the SDK initializes with server data.

2

Does the flag key exist?

If the flag key isn’t found, the SDK returns the defaultValue or control.

// Unknown flag, returns true (defaultValue)

const value = client.flag('foobarbaz', true);

If the flag key was included in the bootstrapped values, this value will be returned.

3

Is the flag disabled?

  • If disabled: The default “off” variant is returned, halting further evaluation.
  • If enabled: The algorithm proceeds to targeting and rollout checks.

Explore Flags: All Users to learn about default variants.

4

Does the flag have Targeting Rules?

5

Does the flag have a Percentage Rollout?

6

Fallback

Returns the “on” variant if no rules or percentages apply.

See Flags: All Users to learn about default variants.

Flow Diagram

No

Yes

No

Yes

No

Yes

Yes

No

Match Found

No Match

Yes

No

Start

SDK Ready?

Return defaultValue/control

Flag Exists?

Flag Enabled?

Return 'off' variant

Targeting Rules?

Evaluate Rules

Percentage Rollout?

Return rule variant

Return rollout variant

Return 'on' variant

End

Next Steps

Dive deeper into the flag evaluation process: