Skip to content

[reactive-element] Make context decorators work with standard decorators#4151

Merged
justinfagnani merged 18 commits into3.0from
3.0-hybrid-decorators-4
Aug 30, 2023
Merged

[reactive-element] Make context decorators work with standard decorators#4151
justinfagnani merged 18 commits into3.0from
3.0-hybrid-decorators-4

Conversation

@justinfagnani
Copy link
Collaborator

Part of #4144

One thing to check on here is how optional fields are translated to auto-accessors and whether or not we have the types correct, and had them correct prior to this PR. The exist tests include a case of an optional field decorated with a non-optional context type. That doesn't exactly work with accessors, which can't be optional, and so have to include undefined in their type to get the same effect. This difference is that this setup requires the context include undefined, whereas optional fields don't. The actual type of optional fields is the same though, so it seems like something was wrong in the original types.

@changeset-bot
Copy link

changeset-bot bot commented Aug 28, 2023

🦋 Changeset detected

Latest commit: 43175a2

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

This PR includes changesets to release 1 package
Name Type
@lit-labs/context Minor

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 Aug 28, 2023

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +11% (-0.59ms - +2.00ms)
    this-change vs tip-of-tree

render

  • this-change: 73.12ms - 76.66ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -7% - +2% (-2.06ms - +0.62ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +1% (-1.48ms - +0.50ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +2% (-0.96ms - +0.83ms)
    this-change vs tip-of-tree

update

  • this-change: 789.74ms - 800.62ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +4% (-2.86ms - +2.86ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +2% (-2.38ms - +1.72ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-6.95ms - +8.51ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 755.44ms - 762.15ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-8.47ms - +8.00ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
73.12ms - 76.66ms-

update

VersionAvg timevs
789.74ms - 800.62ms-

update-reflect

VersionAvg timevs
755.44ms - 762.15ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
26.75ms - 28.84ms-unsure 🔍
-7% - +2%
-2.06ms - +0.62ms
unsure 🔍
-6% - +4%
-1.62ms - +1.23ms
tip-of-tree
tip-of-tree
27.68ms - 29.35msunsure 🔍
-2% - +7%
-0.62ms - +2.06ms
-unsure 🔍
-3% - +6%
-0.75ms - +1.80ms
previous-release
previous-release
27.03ms - 28.95msunsure 🔍
-4% - +6%
-1.23ms - +1.62ms
unsure 🔍
-6% - +3%
-1.80ms - +0.75ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
71.81ms - 76.06ms-unsure 🔍
-4% - +4%
-2.86ms - +2.86ms
unsure 🔍
-5% - +3%
-4.03ms - +2.58ms
tip-of-tree
tip-of-tree
72.02ms - 75.85msunsure 🔍
-4% - +4%
-2.86ms - +2.86ms
-unsure 🔍
-5% - +3%
-3.90ms - +2.46ms
previous-release
previous-release
72.13ms - 77.19msunsure 🔍
-4% - +5%
-2.58ms - +4.03ms
unsure 🔍
-3% - +5%
-2.46ms - +3.90ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
18.75ms - 20.82ms-unsure 🔍
-3% - +11%
-0.59ms - +2.00ms
unsure 🔍
-7% - +9%
-1.40ms - +1.68ms
tip-of-tree
tip-of-tree
18.31ms - 19.86msunsure 🔍
-10% - +3%
-2.00ms - +0.59ms
-unsure 🔍
-10% - +4%
-1.94ms - +0.81ms
previous-release
previous-release
18.51ms - 20.78msunsure 🔍
-8% - +7%
-1.68ms - +1.40ms
unsure 🔍
-4% - +10%
-0.81ms - +1.94ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
48.86ms - 50.13ms-unsure 🔍
-3% - +1%
-1.48ms - +0.50ms
unsure 🔍
-3% - +0%
-1.55ms - +0.22ms
tip-of-tree
tip-of-tree
49.23ms - 50.75msunsure 🔍
-1% - +3%
-0.50ms - +1.48ms
-unsure 🔍
-2% - +2%
-1.15ms - +0.81ms
previous-release
previous-release
49.55ms - 50.78msunsure 🔍
-0% - +3%
-0.22ms - +1.55ms
unsure 🔍
-2% - +2%
-0.81ms - +1.15ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
111.02ms - 113.86ms-unsure 🔍
-2% - +2%
-2.38ms - +1.72ms
unsure 🔍
-3% - +1%
-3.25ms - +1.06ms
tip-of-tree
tip-of-tree
111.30ms - 114.25msunsure 🔍
-2% - +2%
-1.72ms - +2.38ms
-unsure 🔍
-3% - +1%
-2.95ms - +1.43ms
previous-release
previous-release
111.92ms - 115.15msunsure 🔍
-1% - +3%
-1.06ms - +3.25ms
unsure 🔍
-1% - +3%
-1.43ms - +2.95ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
44.05ms - 45.25ms-unsure 🔍
-2% - +2%
-0.96ms - +0.83ms
unsure 🔍
-2% - +2%
-0.95ms - +0.71ms
tip-of-tree
tip-of-tree
44.05ms - 45.38msunsure 🔍
-2% - +2%
-0.83ms - +0.96ms
-unsure 🔍
-2% - +2%
-0.94ms - +0.82ms
previous-release
previous-release
44.20ms - 45.34msunsure 🔍
-2% - +2%
-0.71ms - +0.95ms
unsure 🔍
-2% - +2%
-0.82ms - +0.94ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
815.04ms - 825.22ms-unsure 🔍
-1% - +1%
-6.95ms - +8.51ms
unsure 🔍
-1% - +1%
-6.66ms - +8.89ms
tip-of-tree
tip-of-tree
813.54ms - 825.17msunsure 🔍
-1% - +1%
-8.51ms - +6.95ms
-unsure 🔍
-1% - +1%
-7.94ms - +8.61ms
previous-release
previous-release
813.13ms - 824.90msunsure 🔍
-1% - +1%
-8.89ms - +6.66ms
unsure 🔍
-1% - +1%
-8.61ms - +7.94ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
808.91ms - 820.44ms-unsure 🔍
-1% - +1%
-8.47ms - +8.00ms
unsure 🔍
-1% - +2%
-5.06ms - +12.15ms
tip-of-tree
tip-of-tree
809.03ms - 820.79msunsure 🔍
-1% - +1%
-8.00ms - +8.47ms
-unsure 🔍
-1% - +2%
-4.90ms - +12.46ms
previous-release
previous-release
804.74ms - 817.51msunsure 🔍
-1% - +1%
-12.15ms - +5.06ms
unsure 🔍
-2% - +1%
-12.46ms - +4.90ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions
Copy link
Contributor

The size of lit-html.js and lit-core.min.js are as expected.

Copy link
Collaborator

@rictic rictic left a comment

Choose a reason for hiding this comment

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

This is a small subset of the tests in https://github.com/lit/lit/pull/4009/files

I can land that PR after this one and land all of the tests as part of that

@justinfagnani
Copy link
Collaborator Author

I didn't copy over all of the tests because I'm not entirely happy with how the tests are organized right now. Ideally I would have just copied over the decorator tests, but there aren't tests for just the decorators. There are tests for scenarios, and some components of the tests directly use controllers or use decorators.

It's a little tricky because of the two-part nature of the protocol. It's easier to test a consumer if you have a provider and vice-versa. I don't think it's that great to reimplement half of the context protocol with the possibility of mistakes there. It would be great if there were common protocol interop tests. But even with a combined comsumer/provider test, that could use the controllers only and then we could have isolated and smaller tests for decorators.

Base automatically changed from 3.0-hybrid-decorators-3 to 3.0 August 30, 2023 05:15
@justinfagnani justinfagnani merged commit 5680d48 into 3.0 Aug 30, 2023
@justinfagnani justinfagnani deleted the 3.0-hybrid-decorators-4 branch August 30, 2023 18:50
This was referenced Sep 28, 2023
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.

3 participants