rdkcentral / Lightning-SDK

SDK for Lightning framework
Apache License 2.0
130 stars 69 forks source link

Settings not checking for Null values #227

Closed chiefcll closed 3 years ago

chiefcll commented 3 years ago

https://github.com/rdkcentral/Lightning-SDK/blob/779e85aff338f812b411ab4cbcd7fe2fd7a1b9bd/src/Settings/index.js#L38

Doesn't check for null which is an object

michielvandergeest commented 3 years ago

In what situation have you run into the case where obj equals null?

chiefcll commented 3 years ago

const queryParams = new window.URLSearchParams(document.location.search); const myValue = queryParams.get('blah')) // returns null

So any url params not defined are null

 const platformSettings = {
      languageCode: queryParams.get('language'),
      countryCode: queryParams.get('locale'),
}
michielvandergeest commented 3 years ago

Got it. That's a case we haven't ran into because we usually avoid null values like this and use defaults instead. But I guess it's a valid use case to pass this logic down to the App code. Should be a small fix.

chiefcll commented 3 years ago

https://github.com/rdkcentral/Lightning-SDK/pull/228

michielvandergeest commented 3 years ago

Fixed in v4.3.2 (https://github.com/rdkcentral/Lightning-SDK/blob/master/CHANGELOG.md#v432)