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

feat(wire-service): allow service to add adapter #69

Closed
wants to merge 6 commits into from

Conversation

yungcheng
Copy link
Contributor

@yungcheng yungcheng commented Feb 6, 2018

Details

We currently create adapter registry at service creation and the registry cannot be augmented afterwards. The change is to allow adapters to be added after wire service is created and registered to the engine.

Does this PR introduce a breaking change?

  • Yes
  • No

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: a5ad51d | Target commit: 2351968

benchmark base(a5ad51d) target(2351968) trend
append-1k.benchmark:benchmark-table/add/1k 289.63 (± 4.89 ms) 254.22 (± 4.89 ms) 👍
clear-1k.benchmark:benchmark-table/clear/1k 16.14 (± 0.74 ms) 14.87 (± 0.74 ms) 👍
create-1k.benchmark:benchmark-table/create/1k 183.62 (± 1.20 ms) 153.96 (± 1.20 ms) 👍
update-10th-1k.benchmark:benchmark-table/update-10th/1k 145.66 (± 1.42 ms) 130.76 (± 1.42 ms) 👍

Copy link
Contributor

@caridy caridy left a comment

Choose a reason for hiding this comment

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

let's wait for the formal proposal about wire adapters before we merge this.

@pmdartus
Copy link
Member

pmdartus commented Feb 6, 2018

@diervo Any idea why the benchmark shows substantial improvement?

@diervo
Copy link
Contributor

diervo commented Feb 6, 2018

@pmdartus very odd, let's merge the benchmark PR and investigate further

@yungcheng
Copy link
Contributor Author

changes in packages/lwc-wire-service/src/wired-value.js fix #48

@@ -42,4 +42,10 @@ const wireService = {
export default function registerWireService(register, ...adapterGenerators) {
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use rest argument in platform code, because it compiles to this:

function registerWireService(register) {
  for (var _len = arguments.length, adapterGenerators = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    adapterGenerators[_key - 1] = arguments[_key];
  }

@diervo @rsalvador can we add this to the linting rules?

Copy link
Contributor

Choose a reason for hiding this comment

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

eslint has the opposite rule (prefer-spread), but we could add a custom rule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@caridy that will be a breaking change (not backward compatible) for registerWireService call, I'd prefer to do that in a different PR since it doesn't relate to this one. @kevinv11n fyi

@salesforce-best-lwc-internal
Copy link

Benchmark comparison

Base commit: 72011f2 | Target commit: 381db1c

benchmark base(72011f2) target(381db1c) trend
table-append-1k.benchmark:benchmark-table/append/1k 192.16 (± 2.36 ms) 237.57 (± 4.57 ms) 👎
table-clear-1k.benchmark:benchmark-table/clear/1k 9.25 (± 0.31 ms) 11.19 (± 0.21 ms) 👎
table-create-10k.benchmark:benchmark-table/create/10k 1143.11 (± 4.02 ms) 1365.87 (± 10.36 ms) 👎
table-create-1k.benchmark:benchmark-table/create/1k 112.66 (± 1.30 ms) 139.97 (± 1.13 ms) 👎
table-update-10th-1k.benchmark:benchmark-table/update-10th/1k 110.50 (± 1.18 ms) 133.88 (± 0.97 ms) 👎
tablecmp-append-1k.benchmark:benchmark-table-component/append/1k 251.78 (± 4.47 ms) 299.85 (± 9.93 ms) 👎
tablecmp-clear-1k.benchmark:benchmark-table/clear/1k 22.41 (± 0.91 ms) 29.35 (± 1.12 ms) 👎
tablecmp-create-10k.benchmark:benchmark-table-component/create/10k 1625.68 (± 25.56 ms) 1965.43 (± 17.24 ms) 👎
tablecmp-create-1k.benchmark:benchmark-table-component/create/1k 176.59 (± 2.72 ms) 222.16 (± 2.82 ms) 👎
tablecmp-update-10th-1k.benchmark:benchmark-table-component/update-10th/1k 100.52 (± 1.63 ms) 125.03 (± 3.78 ms) 👎

registerWireAdapter(adapter);
},
unregister: (adapterName) => {
return unregisterWireAdapter(adapterName);
Copy link
Contributor

Choose a reason for hiding this comment

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

@yungcheng @kevinv11n are we concerned about exposing this API ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. We need to finalize #74 and then reflect its design in this PR.

@yungcheng
Copy link
Contributor Author

changes to wire-decorator.test.js are better addressed in #161

The rest would be addressed by the wire adapter rfc implementation #148

@yungcheng yungcheng closed this Mar 16, 2018
@yungcheng yungcheng deleted the vince/wire-service-updates branch March 16, 2018 16:27
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.

7 participants