Skip to content

Commit

Permalink
internal: move regex off routWillChange
Browse files Browse the repository at this point in the history
  • Loading branch information
xg-wang committed Nov 12, 2019
1 parent eaf9ecd commit c338d79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addon/services/prefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { gte } from 'ember-compatibility-helpers';
let PrefetchService;

if (gte('3.6.0')) {
let substatesRegex = /(^|_|\.)(loading$|error$)/;
// remove guard for Ember 3.8 LTS and rev major
PrefetchService = Service.extend({
router: service('router'),
Expand All @@ -16,7 +17,7 @@ if (gte('3.6.0')) {
let seenRoutes = new WeakMap();

this.router.on('routeWillChange', transition => {
if (transition.to && /(^|_|\.)(loading$|error$)/.test(transition.to.name)) {
if (transition.to && substatesRegex.test(transition.to.name)) {
return;
}

Expand Down

0 comments on commit c338d79

Please sign in to comment.