Skip to content

Update the condition in RC service of performance package #1747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2019
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
16 changes: 16 additions & 0 deletions packages/performance/src/services/remote_config_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,21 @@ describe('Performance Monitoring > remote_config_service', () => {

expect(SettingsService.getInstance().loggingEnabled).to.be.true;
});

it('uses secondary configs if the response does not have any fields', async () => {
// Expired local config.
const EXPIRY_LOCAL_STORAGE_VALUE = '1556524895320';
storageGetItemStub.callsFake(
storageGetItemFakeFactory(
EXPIRY_LOCAL_STORAGE_VALUE,
'not a valid config and should not be used'
)
);
const STRINGIFIED_PARTIAL_CONFIG = '{"state":"NO TEMPLATE"}';
fetchStub.resolves(new Response(STRINGIFIED_PARTIAL_CONFIG));
await getConfig(IID);

expect(SettingsService.getInstance().loggingEnabled).to.be.true;
});
});
});
4 changes: 2 additions & 2 deletions packages/performance/src/services/remote_config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ function getRemoteConfig(
function processConfig(
config: RemoteConfigResponse | undefined
): RemoteConfigResponse | undefined {
if (!config || !config.entries) return config;
if (!config) return config;
const settingsServiceInstance = SettingsService.getInstance();
const entries = config.entries;
const entries = config.entries || {};
if (entries.fpr_enabled !== undefined) {
// TODO: Change the assignment of loggingEnabled once the received type is known.
settingsServiceInstance.loggingEnabled =
Expand Down