-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
dd1f4db
to
2b7dd8c
Compare
@@ -1,5 +1,5 @@ | |||
{ | |||
"presets": ["react", "es2015"], | |||
"presets": ["react", "es2015", "stage-2"], |
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.
Allows us to use object spread provided in current es-next Stage 3; babel, for some reason, is currently providing this in stage-2
.
let a = {'one': 1};
let b = {'two': 2};
let c = {...a, ...b};
console.log(c);
// outputs: {'one': 1, 'two': 2}
@@ -94,6 +94,8 @@ Use this if developing elements within `bulbs-elements` locally | |||
$ ./scripts/webpack-dev-server | |||
``` | |||
|
|||
You can access the examples site now by visiting [localhost:8080](). |
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.
A helpful note.
|
||
if (!allProps.disableLazyLoading) { | ||
|
||
return loadOnDemand(BulbsVideoRoot)(allProps); |
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.
This is the main change. If the bulbs-video
instance has not been provided a disable-lazy-loading
property, the video element will be subject to lazy loading.
}; | ||
|
||
beforeEach(() => { | ||
BulbsVideo.prototype.setState = sinon.spy(); | ||
fetchMock.mock(src, {}); | ||
subject = new BulbsVideo(props); |
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.
Moved this into each context that needs it since we want to delay this instantiation in lazy load tests.
} | ||
|
||
requestAnimationFrame(() => { | ||
expect($(container).find('.bulbs-video-root').length).to.equal(1); |
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.
@collin is this the best way we can test this? Doesn't seem to be the best way to do this, but it works.
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.
Yeah, I'm not sure of a better way either.
@@ -5,7 +5,6 @@ import VideoMetaRoot from '../elements/meta/components/root'; | |||
|
|||
export default function Cover (props) { | |||
let { video, actions, enablePosterMeta, disableMetaLink } = props; | |||
let imageId = parseInt(video.poster_url.match(/\d+/)[0], 10); |
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.
Per @collin, this property is no longer used and was throwing errors during tests.
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.
Please ask resolve @MichaelButkovic to resolve @spra85's merge conflicts.
@kand, pulled down the branch and ran the example and I see both requests for |
Ah, bit of a trick that. We could extend the Changing this: export default function loadOnDemand (component) {
const wrapped = (props) => { // eslint-disable-line react/no-multi-comp
return (
<LoadOnDemand
component={component}
componentProps={props}
/>
);
}; ...to something like: export default function loadOnDemand (Component) {
const wrapped = (props) => { // eslint-disable-line react/no-multi-comp
if (props. disableLazyLoading) {
return <Component ...props/>;
}
return (
<LoadOnDemand
component={Component}
componentProps={props}
/>
);
}; Then the bulb-video definition could change to someting like: registerReactElement('bulbs-video', loadOnDemand(BulbsVideo); |
👍 |
Implement
loadOnDemand
wrapper forbulbs-video
to lazy load video elements.Release Type: patch
No large-scale new features, updates should not be breaking.
Updates
bulbs-video
now implementsloadOnDemand
for lazy loading. Lazy loading will occur by default. If this behavior is not necessary for a particularbulbs-video
, give the element thedisable-lazy-loading
attribute to prevent lazy loading.