Skip to content

Commit

Permalink
fix: variant hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Oct 30, 2023
1 parent 84a0f0c commit 5a34aa7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14",
"@types/semver": "7.5.4",
"@unleash/client-specification": "4.5.2",
"@unleash/client-specification": "5.0.2",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^0.34.6",
"eslint-config-custom": "workspace:*",
Expand All @@ -55,7 +55,7 @@
"commander": "11.1.0",
"murmurhash3js": "3.0.1",
"semver": "7.5.4",
"unleash-client": "4.2.1",
"unleash-client": "5.0.0",
"unleash-proxy-client": "3.1.0"
},
"peerDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion lib/src/core/variant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ type Override = {
values: string[];
};

const VARIANT_HASH_SEED = 86028157;

export function getDefaultVariant(): Variant {
return {
name: "disabled",
Expand Down Expand Up @@ -76,7 +78,8 @@ export function selectVariantDefinition(
const target = normalizedValue(
getSeed(context, stickiness),
groupId,
totalWeight
totalWeight,
VARIANT_HASH_SEED
);

let counter = 0;
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a34aa7

Please sign in to comment.