DockYard / ember-in-viewport

Detect if an Ember View or Component is in the viewport @ 60FPS
MIT License
245 stars 91 forks source link

Fix options getter for in-viewport modifier so it returns correct object #297

Closed vstefanovic97 closed 2 years ago

vstefanovic97 commented 2 years ago

I found the options passed to the in-viewport modifier were being ignored. Turns out if we run

const { onEnter, onExit, ...options } = this.args.named;
return options; // it returns { options: {} }

But we need it to return the contents of the options object. You can check this on a simple example

const {...options } = { options: {foo: '42'}};
console.log(options); // logs {options: {…}}
// instead we want it to just log {foo: 42}
vstefanovic97 commented 2 years ago

Turns out this modifier never expected to get options as an argument, sorry for the confusion. I'm closing this PR