Skip to content
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

ComponentState should dereference component on finalize #7612

Merged
merged 2 commits into from
Feb 4, 2023

Conversation

Pessimistress
Copy link
Collaborator

For #7605 (comment)

layer.getCurrentLayer() should return null if the layer has been removed.

Change List

  • ComponentState clears component reference when finalized
  • test-utils testInitializeLayer adds option to defer finalization
  • Unit tests

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

Hmm, I see, opening up for null-valued components does surface bunch of new corner cases and additional if-gauntlets adding to some of the most complex code.

The least painful antidote is presumably a best effort TSdoc pass and firming up API structure and typings where ever we can. .

modules/core/src/lifecycle/component-state.ts Show resolved Hide resolved
@@ -47,6 +47,9 @@ function initializeLayerManager({layer, viewport = testViewport, onError = defau

export function testInitializeLayer(opts) {
const layerManager = initializeLayerManager(opts);
if (opts.finalize === false) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good time to move this test file to .ts and type out the options?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The whole test-utils module is in JS. I will give it a pass in another PR.

test/modules/core/lib/composite-layer.spec.js Outdated Show resolved Hide resolved
@Pessimistress Pessimistress merged commit d512977 into master Feb 4, 2023
@Pessimistress Pessimistress deleted the x/layer-finalize branch February 4, 2023 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants