-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Optimizations 1 #3377
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
base: v11
Are you sure you want to change the base?
Optimizations 1 #3377
Changes from all commits
5cafa08
a161aad
36aea2c
0093169
fb9e058
a5d374c
163c2b5
a66f026
76628f2
1ff1e31
d91270f
320ff6b
9100e82
899b39f
2b1444a
9a6f524
6d7f441
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,3 @@ | ||||||
import { enqueueRender } from './component'; | ||||||
|
||||||
let nextContextId = 0; | ||||||
|
||||||
const providers = new Set(); | ||||||
|
@@ -9,7 +7,7 @@ export const unsubscribeFromContext = internal => { | |||||
if (providers.delete(internal)) return; | ||||||
// ... otherwise, unsubscribe from any contexts: | ||||||
providers.forEach(p => { | ||||||
p._component._subs.delete(internal); | ||||||
p._subs.delete(internal); | ||||||
}); | ||||||
}; | ||||||
|
||||||
|
@@ -21,9 +19,6 @@ export const createContext = (defaultValue, contextId) => { | |||||
_defaultValue: defaultValue, | ||||||
/** @type {import('./internal').FunctionComponent} */ | ||||||
Consumer(props, contextValue) { | ||||||
// return props.children( | ||||||
// context[contextId] ? context[contextId].props.value : defaultValue | ||||||
// ); | ||||||
return props.children(contextValue); | ||||||
}, | ||||||
/** @type {import('./internal').FunctionComponent} */ | ||||||
|
@@ -34,11 +29,11 @@ export const createContext = (defaultValue, contextId) => { | |||||
ctx = {}; | ||||||
ctx[contextId] = this; | ||||||
this.getChildContext = () => ctx; | ||||||
providers.add(this._internal); | ||||||
providers.add(this); | ||||||
} | ||||||
// re-render subscribers in response to value change | ||||||
else if (props.value !== this._prev) { | ||||||
this._subs.forEach(enqueueRender); | ||||||
this._subs.forEach(i => i.render()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Saves some bytes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ha! can't believe I missed that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JoviDeCroock would you believe that actually adds 3b?! gzip There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it comes from the |
||||||
} | ||||||
this._prev = props.value; | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would opt to keep this to
flags
to encourage use of library authors for additional extensions that we don't want to support first-partyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been going back and forth on it. It pains me that this is 23b just for
lags
👁There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the community being able to use this without looking at this file kind off boats well for me but yeah, one opinion 😅 also the types won't ever reflect .f unless we start doing two different type files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true about types too (though that makes me think we should probably already be doing internal VS external files given we have other minified properties)