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

Expand jsdoc documentation for reactive-element and lit-element. #2161

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

AndrewJakubowicz
Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz commented Sep 15, 2021

Context

Add some documentation for some public undocumented methods in lit-element and reactive-element. Addresses github issue: #1883

How

Used lit.dev documentation to guide the jsdocs, and addressed some class members that had no documentation on the lit.dev/docs/api pages.

Added some documentation for previously undocumented:

  • LitElement.connectedCallback()
  • LitElement.disconnectedCallback()
  • ReactiveElement.hasUpdated
  • ReactiveElement.addController
  • ReactiveElement.removeController

Testing

Tested with mouse over in VsCode.

Thank you!

@changeset-bot
Copy link

changeset-bot bot commented Sep 15, 2021

🦋 Changeset detected

Latest commit: b036fd2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2021

📊 Tachometer Benchmark Results

Summary

nop-update

  • lit-html-kitchen-sink: unsure 🔍 -1% - +0% (-0.38ms - +0.11ms)
    this-change vs tip-of-tree

render

  • lit-element-list: unsure 🔍 -1% - +0% (-0.61ms - +0.35ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -1% - +2% (-0.34ms - +0.70ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -1% - +2% (-0.14ms - +0.24ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -1% - +0% (-0.83ms - +0.29ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -1% - +1% (-0.47ms - +0.69ms)
    this-change vs tip-of-tree

update

  • lit-element-list: unsure 🔍 -1% - +1% (-5.88ms - +7.65ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -1% - +2% (-1.23ms - +2.14ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -1% - +1% (-3.21ms - +3.27ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -2% - +1% (-1.96ms - +1.11ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -1% - +0% (-9.28ms - +2.50ms)
    this-change vs tip-of-tree

update-reflect

  • lit-element-list: unsure 🔍 -1% - +2% (-5.20ms - +11.45ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -1% - +1% (-7.71ms - +4.59ms)
    this-change vs tip-of-tree

Results

lit-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
84.81ms - 85.46ms-unsure 🔍
-1% - +0%
-0.61ms - +0.35ms
faster ✔
19% - 20%
19.78ms - 20.66ms
tip-of-tree
tip-of-tree
84.91ms - 85.62msunsure 🔍
-0% - +1%
-0.35ms - +0.61ms
-faster ✔
19% - 19%
19.63ms - 20.55ms
previous-release
previous-release
105.06ms - 105.65msslower ❌
23% - 24%
19.78ms - 20.66ms
slower ❌
23% - 24%
19.63ms - 20.55ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
699.34ms - 708.45ms-unsure 🔍
-1% - +1%
-5.88ms - +7.65ms
faster ✔
8% - 10%
61.25ms - 75.26ms
tip-of-tree
tip-of-tree
698.01ms - 708.02msunsure 🔍
-1% - +1%
-7.65ms - +5.88ms
-faster ✔
8% - 10%
61.83ms - 76.44ms
previous-release
previous-release
766.83ms - 777.47msslower ❌
9% - 11%
61.25ms - 75.26ms
slower ❌
9% - 11%
61.83ms - 76.44ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
761.33ms - 772.98ms-unsure 🔍
-1% - +2%
-5.20ms - +11.45ms
faster ✔
3% - 5%
24.72ms - 40.89ms
tip-of-tree
tip-of-tree
758.08ms - 769.98msunsure 🔍
-1% - +1%
-11.45ms - +5.20ms
-faster ✔
3% - 5%
27.75ms - 44.10ms
previous-release
previous-release
794.35ms - 805.56msslower ❌
3% - 5%
24.72ms - 40.89ms
slower ❌
4% - 6%
27.75ms - 44.10ms
-
lit-html-kitchen-sink

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
34.80ms - 35.79ms-unsure 🔍
-1% - +2%
-0.34ms - +0.70ms
faster ✔
13% - 19%
5.47ms - 8.26ms
tip-of-tree
tip-of-tree
34.97ms - 35.25msunsure 🔍
-2% - +1%
-0.70ms - +0.34ms
-faster ✔
14% - 19%
5.74ms - 8.36ms
previous-release
previous-release
40.86ms - 43.46msslower ❌
15% - 24%
5.47ms - 8.26ms
slower ❌
16% - 24%
5.74ms - 8.36ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
87.49ms - 89.92ms-unsure 🔍
-1% - +2%
-1.23ms - +2.14ms
faster ✔
4% - 8%
3.67ms - 7.93ms
tip-of-tree
tip-of-tree
87.08ms - 89.42msunsure 🔍
-2% - +1%
-2.14ms - +1.23ms
-faster ✔
4% - 9%
4.15ms - 8.36ms
previous-release
previous-release
92.75ms - 96.26msslower ❌
4% - 9%
3.67ms - 7.93ms
slower ❌
5% - 10%
4.15ms - 8.36ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
28.57ms - 28.93ms-unsure 🔍
-1% - +0%
-0.38ms - +0.11ms
faster ✔
1% - 4%
0.40ms - 1.27ms
tip-of-tree
tip-of-tree
28.73ms - 29.04msunsure 🔍
-0% - +1%
-0.11ms - +0.38ms
-faster ✔
1% - 4%
0.28ms - 1.13ms
previous-release
previous-release
29.19ms - 29.98msslower ❌
1% - 4%
0.40ms - 1.27ms
slower ❌
1% - 4%
0.28ms - 1.13ms
-
lit-html-repeat

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
12.17ms - 12.47ms-unsure 🔍
-1% - +2%
-0.14ms - +0.24ms
faster ✔
6% - 9%
0.83ms - 1.15ms
tip-of-tree
tip-of-tree
12.15ms - 12.39msunsure 🔍
-2% - +1%
-0.24ms - +0.14ms
-faster ✔
7% - 9%
0.90ms - 1.18ms
previous-release
previous-release
13.25ms - 13.37msslower ❌
7% - 9%
0.83ms - 1.15ms
slower ❌
7% - 10%
0.90ms - 1.18ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
352.67ms - 357.03ms-unsure 🔍
-1% - +1%
-3.21ms - +3.27ms
faster ✔
28% - 30%
140.37ms - 149.11ms
tip-of-tree
tip-of-tree
352.43ms - 357.21msunsure 🔍
-1% - +1%
-3.27ms - +3.21ms
-faster ✔
28% - 30%
140.29ms - 149.25ms
previous-release
previous-release
495.80ms - 503.38msslower ❌
39% - 42%
140.37ms - 149.11ms
slower ❌
39% - 42%
140.29ms - 149.25ms
-
lit-html-template-heavy

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
57.92ms - 58.58ms-unsure 🔍
-1% - +0%
-0.83ms - +0.29ms
faster ✔
16% - 17%
11.19ms - 12.28ms
tip-of-tree
tip-of-tree
58.07ms - 58.97msunsure 🔍
-0% - +1%
-0.29ms - +0.83ms
-faster ✔
16% - 17%
10.84ms - 12.09ms
previous-release
previous-release
69.55ms - 70.42msslower ❌
19% - 21%
11.19ms - 12.28ms
slower ❌
18% - 21%
10.84ms - 12.09ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
122.17ms - 124.15ms-unsure 🔍
-2% - +1%
-1.96ms - +1.11ms
faster ✔
12% - 14%
16.20ms - 19.37ms
tip-of-tree
tip-of-tree
122.41ms - 124.75msunsure 🔍
-1% - +2%
-1.11ms - +1.96ms
-faster ✔
11% - 13%
15.65ms - 19.07ms
previous-release
previous-release
139.70ms - 142.18msslower ❌
13% - 16%
16.20ms - 19.37ms
slower ❌
13% - 16%
15.65ms - 19.07ms
-
reactive-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
58.00ms - 58.71ms-unsure 🔍
-1% - +1%
-0.47ms - +0.69ms
unsure 🔍
-1% - +1%
-0.56ms - +0.50ms
tip-of-tree
tip-of-tree
57.79ms - 58.70msunsure 🔍
-1% - +1%
-0.69ms - +0.47ms
-unsure 🔍
-1% - +1%
-0.74ms - +0.46ms
previous-release
previous-release
57.99ms - 58.78msunsure 🔍
-1% - +1%
-0.50ms - +0.56ms
unsure 🔍
-1% - +1%
-0.46ms - +0.74ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
713.08ms - 721.74ms-unsure 🔍
-1% - +0%
-9.28ms - +2.50ms
unsure 🔍
-1% - +1%
-8.95ms - +3.88ms
tip-of-tree
tip-of-tree
716.80ms - 724.80msunsure 🔍
-0% - +1%
-2.50ms - +9.28ms
-unsure 🔍
-1% - +1%
-5.34ms - +7.05ms
previous-release
previous-release
715.21ms - 724.68msunsure 🔍
-1% - +1%
-3.88ms - +8.95ms
unsure 🔍
-1% - +1%
-7.05ms - +5.34ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
808.66ms - 817.05ms-unsure 🔍
-1% - +1%
-7.71ms - +4.59ms
unsure 🔍
-1% - +1%
-6.29ms - +6.14ms
tip-of-tree
tip-of-tree
809.93ms - 818.90msunsure 🔍
-1% - +1%
-4.59ms - +7.71ms
-unsure 🔍
-1% - +1%
-4.93ms - +7.90ms
previous-release
previous-release
808.35ms - 817.51msunsure 🔍
-1% - +1%
-6.14ms - +6.29ms
unsure 🔍
-1% - +1%
-7.90ms - +4.93ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link
Member

@aomarks aomarks left a comment

Choose a reason for hiding this comment

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

Nice docs!

Link thing is optional -- maybe something we should do as a search/replace across everything.

Copy link
Contributor

@arthurevans arthurevans left a comment

Choose a reason for hiding this comment

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

LGTM. Added a few minor suggestions.

packages/reactive-element/src/reactive-element.ts Outdated Show resolved Hide resolved
packages/reactive-element/src/reactive-element.ts Outdated Show resolved Hide resolved
Co-authored-by: Arthur Evans <arthure@google.com>
@@ -759,11 +759,15 @@ export abstract class ReactiveElement
private __updatePromise!: Promise<boolean>;

/**
* Internal flag marking a pending update.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Authors can definitely read this flag. It might be handy in custom getUpdateComplete implementations... so maybe instead of "Internal" just say that it's true if there's a pending update as a result of a requestUpdate() call and it should only be read.

* @category updates
*/
isUpdatePending = false;

/**
* Is set to `true` after the first update. Required for compatibility with
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd remove the "required for..." and just say "The element cannot assume..."

@@ -817,6 +821,9 @@ export abstract class ReactiveElement
}

/**
* Registers a `ReactiveController` to participate in the element's reactive update cycle.
* The element automatically calls into any registered controllers during its
* lifecycle callbacks.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add "If the element is connected when addController() is called, the controller's hostConnected() callback will be immediately called.

@AndrewJakubowicz
Copy link
Contributor Author

Is this ok to merge with the failing tests? None of them seem related to jsdocs?

@aomarks
Copy link
Member

aomarks commented Sep 16, 2021

Is this ok to merge with the failing tests? None of them seem related to jsdocs?

The changeset failure is because there's no changeset. Might actually make sense here, since it is a change to the distributed package, and a changeset will signal that there is a pending change that hasn't been released yet, and eventually make its way into the CHANGELOG. You can use npx changeset for a wizard that lets you create an entry.

I think the Sauce tests always fail, something has been up with those for weeks. IE11 busted? Not sure.

@aomarks
Copy link
Member

aomarks commented Sep 16, 2021

The changeset failure is because there's no changeset. Might actually make sense here, since it is a change to the distributed package, and a changeset will signal that there is a pending change that hasn't been released yet, and eventually make its way into the CHANGELOG. You can use npx changeset for a wizard that lets you create an entry.

Just something general like "Additional documentation on Lit APIs" or something seems fine.

@AndrewJakubowicz AndrewJakubowicz merged commit 08f6032 into main Sep 16, 2021
@AndrewJakubowicz AndrewJakubowicz deleted the expand-lit2-docs branch September 16, 2021 22:39
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.

None yet

4 participants