Skip to content

Alternate prop validator - #1937

Merged
quantizor merged 5 commits into
developfrom
alternate-prop-validator
Aug 21, 2018
Merged

quantizor merged 5 commits into
developfrom
alternate-prop-validator

Conversation

@quantizor

Copy link
Copy Markdown
Contributor

It's lighter and faster since it's memoized. Saw some nice perf gain in benchmarking.

before:

---Mount deep tree---
17.14 ±01.82 ms
(S/L) 13.06/04.08 ms

---Mount wide tree---
22.89 ±02.67 ms
(S/L) 16.91/05.98 ms

---Update dynamic styles---
23.47 ±05.14 ms
(S/L) 07.98/15.49 ms

after:

---Mount deep tree---
16.07 ±01.72 ms
(S/L) 12.03/04.05 ms

---Mount wide tree---
21.45 ±02.74 ms
(S/L) 15.59/05.85 ms

---Update dynamic styles---
22.49 ±05.28 ms
(S/L) 07.50/14.99 ms

Need emotion-js/emotion#814 & yarn update before merging

cc @Andarist 🚀

They are no longer a thing in v16+
It's lighter and faster since its memoized. Saw some nice perf
gain in benchmarking.

before:

---Mount deep tree---
17.14 ±01.82 ms
(S/L) 13.06/04.08 ms

---Mount wide tree---
22.89 ±02.67 ms
(S/L) 16.91/05.98 ms

---Update dynamic styles---
23.47 ±05.14 ms
(S/L) 07.98/15.49 ms

after:

---Mount deep tree---
16.07 ±01.72 ms
(S/L) 12.03/04.05 ms

---Mount wide tree---
21.45 ±02.74 ms
(S/L) 15.59/05.85 ms

---Update dynamic styles---
22.49 ±05.28 ms
(S/L) 07.50/14.99 ms
@quantizor
quantizor requested review from kitten and mxstbr August 21, 2018 16:24
@@ -0,0 +1,3 @@
declare module '@emotion/is-prop-valid' {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the package is written using flow & ships a siblings files to entry points: dist/is-prop-valid.cjs.js.flow & is-prop-valid.esm.js.flow

flow should pick those typings automatically 🤔 hasnt it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was raising a module not found error... dunno

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the info, need to investigate it later

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You’re probably ignoring everything in node_modules. You might want to use the new declarations option in flow which ignores errors in the specified folders but still uses the type declarations. (You might be on an older version of flow that doesn’t support it though so you might need to update flow)

@kitten kitten left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! 🙌 not sure why we haven’t memorised ours actually.

+1 for not duplicating work on validAttrs anymore 😅

import validAttr from '../validAttr'
import validAttr from '@emotion/is-prop-valid'

describe('validAttr', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let’s maybe remove these tests.

I assume that the package on its own is sufficiently tested

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I waffled back and forth on that. In case we switch again in the future, I was thinking we should keep these. They did reveal some missing props 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually our list might not be tested, gonna shamelessly copy ur tests later to cover that ;)

@Andarist

Copy link
Copy Markdown
Contributor

Im wondering. Do u consider this a breaking change or not? Such cases are always tricky in this regard

@quantizor

Copy link
Copy Markdown
Contributor Author

@Andarist nah, all tests are passing other than the PR against emotion so it's not breaking

@emmatown

Copy link
Copy Markdown

Just published @emotion/[email protected] with the changes.

@quantizor
quantizor merged commit d764884 into develop Aug 21, 2018
@quantizor
quantizor deleted the alternate-prop-validator branch August 21, 2018 23:13
@mxstbr

mxstbr commented Aug 22, 2018

Copy link
Copy Markdown
Member

Yay!

@dimitropoulos dimitropoulos mentioned this pull request Nov 1, 2019
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.

5 participants