Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit replaces our Lit2 implementation with a Lit3 implementation. This upgrade required two major shifts within our code, both of them consequential. First, the restructuring of the way the get/set decorators for properties and states meant that a lot of the code we were using needed to be refactored. More than that, a lot of those custom accessors were implemented to trigger side-effects, such as when a providerID is set or changed triggering the ProviderView to fetch the requsted Provider. The Lit2 and Lit3 documentation both say [there is a better way to handle this](https://lit.dev/docs/v2/components/properties/#:~:text=In%20most%20cases%2C%20you%20do%20not%20need%20to%20create%20custom%20property%20accessors) by detecting the change in the `willUpdate()` point of an elements Lifecycle and triggering the side effect there instead. I've done this in several places with a pattern of detecting the change, and then naming the corresponding change as `fetchRequestedThing()`. The resulting code is cleaner and uses fewer controversial features. The other is that the type signature for `LitElement.createRenderRoot()` has changed to be either an HTMLElement or a DocumentFragment. This required some serious refactoring of type changes through Base and Interface codes. Noteably, the custom `AdoptedStyleSheetsElement` interface has been superseded by the supplied and standardized [DocumentOrShadowRoot](https://github.com/microsoft/TypeScript/blob/aa2b2352e1d506bf26b6423b74c61e45a63b4ea5/src/lib/dom.generated.d.ts#L4715) interface. Unfortunately, that interface is a mixin, and casting or instance checking are still in place to make sure the objects being manipulated are typed "correctly." Three files I touched during the course of this triggered SonarJS, so there are some minor fixes, replacing some awkward syntax with more idiomatic code. These are very minor, such as replacing: ``` const result = someFunction(); return result; /* with */ return someFunction(); ``` and ``` const result = x(); if (!result) { return true } else { return false } /* with */ return !x(); ```
- Loading branch information