Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/sdk/browser/contract-tests/entity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"description": "Contract test service implementation for @launchdarkly/js-client-sdk",
"scripts": {
"start": "vite --open=true",
"start": "tsc --noEmit && vite --open=true",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the typescript it valid when running the dev server.

"build": "tsc --noEmit && vite build",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There wasn't a build command, so it didn't run with the root build.

"lint": "eslint ./src",
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../../.prettierignore"
},
Expand Down
16 changes: 4 additions & 12 deletions packages/sdk/browser/contract-tests/entity/src/ClientEntity.ts
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to update this when I removed AutoEnvAttributes.

Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
AutoEnvAttributes,
init,
LDClient,
LDLogger,
LDOptions,
} from '@launchdarkly/js-client-sdk';
import { init, LDClient, LDLogger, LDOptions } from '@launchdarkly/js-client-sdk';

import { CommandParams, CommandType, ValueType } from './CommandParams';
import { CreateInstanceParams, SDKConfigParams } from './ConfigParams';
Expand Down Expand Up @@ -72,6 +66,8 @@ function makeSdkConfig(options: SDKConfigParams, tag: string) {
};
}

cf.fetchGoals = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't fetch goals. It confuses the test harness.


return cf;
}

Expand Down Expand Up @@ -205,11 +201,7 @@ export async function newSdkClientEntity(options: CreateInstanceParams) {
options.configuration.clientSide?.initialUser ||
options.configuration.clientSide?.initialContext ||
makeDefaultInitialContext();
const client = init(
options.configuration.credential || 'unknown-env-id',
AutoEnvAttributes.Disabled, // TODO: Determine capability.
sdkConfig,
);
const client = init(options.configuration.credential || 'unknown-env-id', sdkConfig);
let failed = false;
try {
await Promise.race([
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk/browser/src/BrowserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
LDContext,
Platform,
} from '@launchdarkly/js-client-sdk-common';
import { LDIdentifyOptions } from '@launchdarkly/js-client-sdk-common/dist/api/LDIdentifyOptions';

import GoalManager from './goals/GoalManager';
import { Goal, isClick } from './goals/Goals';
Expand Down Expand Up @@ -135,8 +136,8 @@ export class BrowserClient extends LDClientImpl {
};
}

override async identify(context: LDContext): Promise<void> {
await super.identify(context);
override async identify(context: LDContext, identifyOptions?: LDIdentifyOptions): Promise<void> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this, which doesn't make the SDK not work, but does cause problems for the test harness.

await super.identify(context, identifyOptions);
this.goalManager?.startTracking();
}
}