Skip to content

Conversation

@FedericoAmura
Copy link
Contributor

@FedericoAmura FedericoAmura commented Oct 1, 2024

Description

This PR removes the global variables used in several to share configs between modules or helper functions
Also removes the cdn installation instructions as those depend on a now gone global variable
The intent for this is to allow consumers of the SDK to have multiple versions of it without conflicts

Changelog

  • globalThis.litWCProvider from auth-browser package is gone
  • added setMiscLitConfig function to pass litCore config up to misc package instead of relying on globalThis.litConfig

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@joshLong145 joshLong145 self-requested a review October 3, 2024 14:53

// check if config is loaded yet
if (!globalThis?.litConfig) {
if (!litConfig) {

Choose a reason for hiding this comment

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

Making a note to reevaluate this module of scoping of the LitConfig instance for the logger refactor task: https://linear.app/litprotocol/issue/LIT-3921/migrate-to-interfacing-with-logger-through-module-over-global-object

Copy link
Collaborator

@Ansonhkg Ansonhkg left a comment

Choose a reason for hiding this comment

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

LGTM

if (isBrowser()) {
// @ts-ignore
globalThis.litWCProvider = wcProvider;
litWCProvider = wcProvider;
Copy link
Collaborator

Choose a reason for hiding this comment

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

double checked that this variable is not used in other modules as it's now locally scoped instead of global

@FedericoAmura FedericoAmura merged commit 8013aff into staging/v7 Oct 7, 2024
4 checks passed
@FedericoAmura FedericoAmura deleted the feature/lit-3918-no-globalthis-variables-anymore branch October 7, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants