Skip to content

Commit

Permalink
Removing everything related to scrollTrigger.
Browse files Browse the repository at this point in the history
The latest vue router seems to behave exactly as it does with the modified scrollBehavior so it can all be removed.
  • Loading branch information
codyrancher committed Feb 21, 2024
1 parent 0cb47c5 commit 65e0ba4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 96 deletions.
5 changes: 0 additions & 5 deletions shell/components/nuxt/nuxt-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ export default {

const listeners = {}

// Add triggerScroll event on beforeEnter (fix #1376)
const beforeEnter = listeners.beforeEnter
listeners.beforeEnter = (el) => {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll')
})
if (beforeEnter) {
return beforeEnter.call(_parent, el)
}
Expand Down
2 changes: 0 additions & 2 deletions shell/config/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Vue from 'vue';
import Router from 'vue-router';
import { normalizeURL } from 'ufo';
import { interopDefault } from '../utils/nuxt';
import scrollBehavior from '../utils/router.scrollBehavior.js';

const emptyFn = () => {};

Expand All @@ -12,7 +11,6 @@ export const routerOptions = {
mode: 'history',
// Note: router base comes from the ROUTER_BASE env var
base: process.env.routerBase || '/',
scrollBehavior,

routes: [
{
Expand Down
11 changes: 0 additions & 11 deletions shell/initialize/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ function fixPrepatch(to, ___) {
const instances = getMatchedComponentsInstances(to);
const Components = getMatchedComponents(to);

let triggerScroll = false;

Vue.nextTick(() => {
instances.forEach((instance, i) => {
if (!instance || instance._isDestroyed) {
Expand All @@ -507,18 +505,9 @@ function fixPrepatch(to, ___) {
for (const key in newData) {
Vue.set(instance.$data, key, newData[key]);
}

triggerScroll = true;
}
});

if (triggerScroll) {
// Ensure to trigger scroll event after calling scrollBehavior
window.$nuxt.$nextTick(() => {
window.$nuxt.$emit('triggerScroll');
});
}

checkForErrors(this);

// Hot reloading
Expand Down
78 changes: 0 additions & 78 deletions shell/utils/router.scrollBehavior.js

This file was deleted.

0 comments on commit 65e0ba4

Please sign in to comment.