Skip to content

Commit

Permalink
Removing unused $nuxt.{suffixes} that I found
Browse files Browse the repository at this point in the history
- routeChanged  (didn't find any watches of this event)
- nbFetching (The only place reading this was a computed property which wasn't used anywhere)
  • Loading branch information
codyrancher committed Feb 22, 2024
1 parent 65e0ba4 commit fe7433e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
6 changes: 0 additions & 6 deletions shell/initialize/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export default {
isOnline: true,

showErrorPage: false,

nbFetching: 0
}),

beforeCreate() {
Expand Down Expand Up @@ -65,10 +63,6 @@ export default {
isOffline() {
return !this.isOnline;
},

isFetching() {
return this.nbFetching > 0;
},
},

methods: {
Expand Down
15 changes: 1 addition & 14 deletions shell/initialize/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ const isDev = process.env.dev;
const debug = isDev;

// Fetch mixin
if (!Vue.__nuxt__fetch__mixin__) {
Vue.mixin(fetchMixin);
Vue.__nuxt__fetch__mixin__ = true;
}
Vue.mixin(fetchMixin);

// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink);
Expand Down Expand Up @@ -173,7 +170,6 @@ async function loadAsyncComponents(to, from, next) {
}

this.error({ statusCode, message });
this.$nuxt.$emit('routeChanged', to, from, err);
next();
}
}
Expand Down Expand Up @@ -444,15 +440,11 @@ async function render(to, from, next) {
} catch (err) {
const error = err || {};

if (error.message === 'ERR_REDIRECT') {
return this.$nuxt.$emit('routeChanged', to, from, error);
}
_lastPaths = [];

globalHandleError(error);

this.error(error);
this.$nuxt.$emit('routeChanged', to, from, error);
next();
}
}
Expand Down Expand Up @@ -527,11 +519,6 @@ function nuxtReady(_app) {
if (typeof window._onNuxtLoaded === 'function') {
window._onNuxtLoaded(_app);
}
// Add router hooks
router.afterEach((to, from) => {
// Wait for fixPrepatch + $data updates
Vue.nextTick(() => _app.$nuxt.$emit('routeChanged', to, from));
});
}

const noopData = () => {
Expand Down
3 changes: 0 additions & 3 deletions shell/mixins/fetch.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function $fetch() {
}

async function $_fetch() { // eslint-disable-line camelcase
this.$nuxt.nbFetching++;
this.$fetchState.pending = true;
this.$fetchState.error = null;
this._hydrated = false;
Expand All @@ -90,6 +89,4 @@ async function $_fetch() { // eslint-disable-line camelcase
this.$fetchState.error = error;
this.$fetchState.pending = false;
this.$fetchState.timestamp = Date.now();

this.$nextTick(() => this.$nuxt.nbFetching--);
}

0 comments on commit fe7433e

Please sign in to comment.