Skip to content

Commit feef59e

Browse files
scalvertRobbieTheWagner
authored andcommitted
Change scheduleOnce to schedule (#419)
Using `scheduleOnce` with an anonymous function [doesn't actually schedule only once](https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md), since a new function is created on every invocation. This PR just changes to use `schedule`, which I believe is fine in this case.
1 parent 034b700 commit feef59e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

addon/initializers/route-anchor-jump.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Route from '@ember/routing/route';
2-
import { scheduleOnce } from '@ember/runloop';
2+
import { schedule } from '@ember/runloop';
33

44
Route.reopen({
55
afterModel() {
66
if (typeof location !== 'undefined') {
77
const { hash } = location;
88
if (hash && hash.length) {
9-
scheduleOnce('afterRender', null, () => {
9+
schedule('afterRender', null, () => {
1010
const anchor = document.querySelector(`a[href="${hash}"`);
1111
if (anchor) {
1212
anchor.scrollIntoView();

0 commit comments

Comments
 (0)