Skip to content

bug: Remove execution context determination #787

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 4 commits into from
Sep 26, 2022

Conversation

mikechu-optimizely
Copy link
Contributor

Summary

  • Removing an attempt to distinguish between execution contexts (browser vs. node).
  • We found the in demo prep, this implementation was incorrect and causing bugs
  • We need a better solution to handle context determination
  • For now, simple check for the presence of window === Browser and process === Node is being used for the new code path
  • This PR relates to 786

Test plan

  • All tests still pass after removal

Issues

  • FSSDK-8386 (OASIS-8386 [to pass jira_ticket_reference_check])

@coveralls
Copy link

coveralls commented Sep 22, 2022

Coverage Status

Coverage remained the same at 93.46% when pulling 61c9b96 on mike/remove-execution-context into 346f2c0 on master.

@mikechu-optimizely
Copy link
Contributor Author

@zashraf1985 This PR should be merged first before 786.

# Conflicts:
#	packages/optimizely-sdk/lib/index.browser.ts
#	packages/optimizely-sdk/lib/index.react_native.ts
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/browser_http_polling_datafile_manager';
import { EXECUTION_CONTEXT_TYPE } from './utils/enums';
import { ExecutionContext } from './utils/execution_context';
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/http_polling_datafile_manager';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zashraf1985 @ozayr-zaviar I'm worried that I may not have merged this correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this should probably be './plugins/datafile_manager/browser_http_polling_datafile_manager' I think

import { createHttpPollingDatafileManager } from './plugins/datafile_manager/react_native_http_polling_datafile_manager';
import { EXECUTION_CONTEXT_TYPE } from './utils/enums';
import { ExecutionContext } from './utils/execution_context';
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/http_polling_datafile_manager';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This too might not be correct either.

Should it be ./plugins/datafile_manager/react_native_http_polling_datafile_manager or './plugins/datafile_manager/http_polling_datafile_manager'?

@zashraf1985 @ozayr-zaviar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this one should be react_native_http_polling_datafile_manager. Grrr. Sorry I messed this merge up.

@mikechu-optimizely mikechu-optimizely requested review from ozayr-zaviar and removed request for jaeopt September 23, 2022 18:23
Comment on lines +27 to +32
if (window) {
return new BrowserRequestHandler(logger, timeout);
} else if (process) {
return new NodeRequestHandler(logger, timeout);
} else {
return null as unknown as RequestHandler;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will get removed by #786

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well the whole file will...

@mikechu-optimizely mikechu-optimizely merged commit 267f12b into master Sep 26, 2022
@mikechu-optimizely mikechu-optimizely deleted the mike/remove-execution-context branch September 26, 2022 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants