Skip to content

Commit bce49b5

Browse files
committed
update featureConditions to be a reactive value instead of a ref with a reactive value
1 parent f65131b commit bce49b5

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

dist/index.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type FlagOptionsType = {
88
type GetFeatureFlagType = (params: FlagOptionsType) => {
99
isFeatureEnabled: Ref<boolean>;
1010
featureDescription: Ref<string>;
11-
featureConditions: Ref<IConditions>;
11+
featureConditions: IConditions;
1212
};
1313
interface IFeatureFlagsManager {
1414
appConfigurationClient: AppConfigurationClientType;

dist/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type FlagOptionsType = {
88
type GetFeatureFlagType = (params: FlagOptionsType) => {
99
isFeatureEnabled: Ref<boolean>;
1010
featureDescription: Ref<string>;
11-
featureConditions: Ref<IConditions>;
11+
featureConditions: IConditions;
1212
};
1313
interface IFeatureFlagsManager {
1414
appConfigurationClient: AppConfigurationClientType;

dist/index.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ var featureFlagsManager = (connectionString, cacheEnabled = true, flagsToPrefetc
5454
cache[cacheKey] = {
5555
isFeatureEnabled: ref(enabled),
5656
featureDescription: ref(description),
57-
featureConditions: ref(reactive({
57+
featureConditions: reactive({
5858
clientFilters: (_a = conditions.clientFilters) != null ? _a : []
59-
}))
59+
})
6060
};
6161
}
6262
}).catch((error) => {
@@ -77,7 +77,7 @@ var featureFlagsManager = (connectionString, cacheEnabled = true, flagsToPrefetc
7777
}
7878
const isFeatureEnabled = ref(false);
7979
const featureDescription = ref("");
80-
const featureConditions = ref(reactive({}));
80+
const featureConditions = reactive({});
8181
if (!appConfigurationClient) {
8282
if (cacheEnabled) {
8383
cache[cacheKey] = { isFeatureEnabled, featureDescription, featureConditions };
@@ -94,7 +94,7 @@ var featureFlagsManager = (connectionString, cacheEnabled = true, flagsToPrefetc
9494
} = parseFeatureFlag(response);
9595
isFeatureEnabled.value = enabled;
9696
featureDescription.value = description;
97-
featureConditions.value = conditions;
97+
Object.assign(conditions, featureConditions);
9898
if (cacheEnabled) {
9999
cache[cacheKey] = { isFeatureEnabled, featureDescription, featureConditions };
100100
}
@@ -136,9 +136,9 @@ var featureFlagsManagerAsync = (_0, ..._1) => __async(void 0, [_0, ..._1], funct
136136
cache[cacheKey] = {
137137
isFeatureEnabled: ref(enabled),
138138
featureDescription: ref(description),
139-
featureConditions: ref(reactive({
139+
featureConditions: reactive({
140140
clientFilters: (_a = conditions.clientFilters) != null ? _a : []
141-
}))
141+
})
142142
};
143143
}
144144
} catch (error) {
@@ -160,9 +160,9 @@ var featureFlagsManagerAsync = (_0, ..._1) => __async(void 0, [_0, ..._1], funct
160160
cache[cacheKey] = {
161161
isFeatureEnabled: ref(false),
162162
featureDescription: ref(""),
163-
featureConditions: ref(reactive({
163+
featureConditions: reactive({
164164
clientFilters: []
165-
}))
165+
})
166166
};
167167
return cache[cacheKey];
168168
};

dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type FlagOptionsType = {
1414
type GetFeatureFlagType = (params: FlagOptionsType) => {
1515
isFeatureEnabled: Ref<boolean>;
1616
featureDescription: Ref<string>;
17-
featureConditions: Ref<IConditions>;
17+
featureConditions: IConditions;
1818
};
1919

2020
interface IFeatureFlagsManager {
@@ -39,7 +39,7 @@ interface IFeatureFlagCache {
3939
[key: string]: {
4040
isFeatureEnabled: Ref<boolean>;
4141
featureDescription: Ref<string>;
42-
featureConditions: Ref<IConditions>;
42+
featureConditions: IConditions;
4343
};
4444
}
4545

@@ -77,9 +77,9 @@ const featureFlagsManager = (
7777
cache[cacheKey] = {
7878
isFeatureEnabled: ref(enabled),
7979
featureDescription: ref(description),
80-
featureConditions: ref(reactive({
80+
featureConditions: reactive({
8181
clientFilters: conditions.clientFilters ?? []
82-
}))
82+
})
8383
};
8484
}
8585
})
@@ -105,7 +105,7 @@ const featureFlagsManager = (
105105

106106
const isFeatureEnabled = ref(false);
107107
const featureDescription = ref("");
108-
const featureConditions = ref(reactive({}))
108+
const featureConditions = reactive({})
109109

110110
if (!appConfigurationClient) {
111111
if (cacheEnabled) {
@@ -127,7 +127,7 @@ const featureFlagsManager = (
127127

128128
isFeatureEnabled.value = enabled;
129129
featureDescription.value = description;
130-
featureConditions.value = conditions
130+
Object.assign(conditions, featureConditions)
131131

132132
if (cacheEnabled) {
133133
cache[cacheKey] = { isFeatureEnabled, featureDescription, featureConditions };
@@ -183,9 +183,9 @@ const featureFlagsManagerAsync = async (
183183
cache[cacheKey] = {
184184
isFeatureEnabled: ref(enabled),
185185
featureDescription: ref(description),
186-
featureConditions: ref(reactive({
186+
featureConditions: reactive({
187187
clientFilters: conditions.clientFilters ?? []
188-
}))
188+
})
189189
};
190190
}
191191
} catch (error) {
@@ -210,9 +210,9 @@ const featureFlagsManagerAsync = async (
210210
cache[cacheKey] = {
211211
isFeatureEnabled: ref(false),
212212
featureDescription: ref(""),
213-
featureConditions: ref(reactive({
213+
featureConditions: reactive({
214214
clientFilters: []
215-
}))
215+
})
216216
};
217217

218218
return cache[cacheKey];

0 commit comments

Comments
 (0)