",[2047],{"name":2037,"color":2048},"a2eeef","Add configuration options for fetch timeout, fetch retries and retry delays","2025-02-07T02:36:55Z","https://github.com/nuxt/scripts/issues/347",{"description":2053,"labels":2054,"number":2058,"owner":1988,"repository":1988,"state":2011,"title":2059,"updated_at":2060,"url":2061,"score":2062},"I've got an issue where I'm setting some data with asyncData, I then update that data, then I change page and the data reverts.\r\n\r\nSo basically I call another function from asyncData in a page component like this:\r\n```js\r\nasyncData (context) {\r\n return ApiPage.getPage(context, context.params.page, 'pages', 'page')\r\n}\r\n```\r\n\r\nThen the file with that function is this (_ApiPage.js):\r\n```js\r\nconst masterData = {\r\n body: '',\r\n form: null,\r\n formData: null,\r\n hasChildren: false,\r\n header: '',\r\n id: '',\r\n label: '',\r\n name: '',\r\n sideMenu: [],\r\n subLabel: '',\r\n subHeader: null\r\n}\r\n\r\nconst AxiosError = function (status, message) {\r\n return {\r\n response: {\r\n status: status,\r\n data: {\r\n message: message\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default {\r\n mixins: {\r\n methods: {\r\n reloadSideMenu () {\r\n if (this.slug !== '' && this.hasChildren) {\r\n this.$axios.get(this.$store.getters.getApiUrl('menus/home/' + this.slug))\r\n .then((res) => {\r\n this.sideMenu = res.data\r\n })\r\n }\r\n }\r\n }\r\n },\r\n getPage ({ error, store, app }, slug, patchUrlPrefix, cmsKey) {\r\n return app.$axios.get(slug)\r\n .then((res) => {\r\n if (res.statusCode) {\r\n throw new AxiosError(res.statusCode, res.message)\r\n }\r\n if (typeof res.data !== 'object' || !res.data.id) {\r\n throw new AxiosError(404, '')\r\n }\r\n let newData = Object.assign({\r\n slug: slug\r\n }, masterData, res.data)\r\n if (store.getters.getAuthUser() && store.getters.hasRole('ROLE_ADMIN')) {\r\n newData.patchUrl = store.getters.getApiUrl(patchUrlPrefix + '/' + res.data.id)\r\n store.commit('cms/initEndpoint', {\r\n endpoint: newData.patchUrl,\r\n initKey: cmsKey\r\n })\r\n }\r\n // Set whether any further requests are now needed\r\n let loadSideMenu = newData.slug !== '' && newData.hasChildren\r\n let loadForm = newData.form\r\n if (!loadSideMenu && !loadForm) {\r\n return newData\r\n }\r\n // Setup extra requests\r\n let requests = []\r\n let loadPaths = {\r\n form: store.getters.getApiUrl('form/' + slug),\r\n sideMenu: store.getters.getApiUrl('menus/home/' + slug)\r\n }\r\n if (loadForm) {\r\n requests.push(app.$axios.get(loadPaths.form))\r\n }\r\n if (loadSideMenu) {\r\n requests.push(app.$axios.get(loadPaths.sideMenu))\r\n }\r\n // Process sub-requests\r\n return Promise.all(requests)\r\n .then((allRes) => {\r\n for (const res of allRes) {\r\n switch (res.config.url) {\r\n case loadPaths.form:\r\n newData = Object.assign(newData, {\r\n formData: Object.assign(\r\n {},\r\n {\r\n lastModified: res.headers['last-modified']\r\n },\r\n res.data\r\n )\r\n })\r\n break\r\n case loadPaths.sideMenu:\r\n newData = Object.assign(newData, {\r\n sideMenu: res.data\r\n })\r\n break\r\n }\r\n }\r\n return newData\r\n })\r\n .catch((err) => {\r\n error({\r\n statusCode: err.response.status,\r\n message: 'The page\\'s dependencies could not be loaded'\r\n })\r\n })\r\n })\r\n .catch((err) => {\r\n if (err.response) {\r\n error({\r\n statusCode: err.response.status,\r\n message: (err.response.status === 404 ? 'Page could not be found' : err.response.data.message)\r\n })\r\n } else {\r\n if (typeof err === 'string') {\r\n error({\r\n statusCode: 500,\r\n message: err\r\n })\r\n } else {\r\n error({\r\n statusCode: 500,\r\n message: 'An error occurred'\r\n })\r\n }\r\n }\r\n })\r\n }\r\n}\r\n```\r\n\r\nSo I load data and populate `sideMenu`. When I update some pages, the title will affect the URL that needs to be in the menu. So I refresh the menu with the `reloadSideMenu` method - so far so good.\r\n\r\nI then go to another page which using the `_ApiPage.js` file. The sideMenu variable then reverts to the original state that asyncData had set for the page. I've tried logging to the console, and nowhere in my scripts where I set that variable is being reached.\r\n\r\nAny ideas?\n\n\u003C!--cmty-->\u003C!--cmty_prevent_hook-->\n\u003Cdiv align=\"right\">\u003Csub>\u003Cem>This question is available on \u003Ca href=\"https://nuxtjs.cmty.io\">Nuxt.js\u003C/a> community (\u003Ca href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c996\">#c996\u003C/a>)\u003C/em>\u003C/sub>\u003C/div>",[2055],{"name":2056,"color":2057},"2.x","d4c5f9",1134,"asyncData reverting after data modified","2023-01-18T15:40:52Z","https://github.com/nuxt/nuxt/issues/1134",0.7726582,{"description":2064,"labels":2065,"number":1987,"owner":1988,"repository":2028,"state":2011,"title":2068,"updated_at":2069,"url":2070,"score":1994},"Related to nuxtlabs/api.nuxt.com#190\n\nHere is the draft send by the api (it suits Github draft syntax and works well when commiting then publishing the branch): \n```json\n {\n additions: [\n { new: true, path: 'public/media2renamed.jpeg', oldPath: 'public/media2.jpeg' },\n { new: false, content: 'base64', path: 'public/media2.jpeg' }\n ],\n deletions: []\n }\n```\n \n\n\n",[2066],{"name":1999,"color":2067},"ff281a","The `computedFiles` does not handle cache management complex combinations","2023-02-15T12:31:27Z","https://github.com/nuxt/nuxt.com/issues/447",{"description":2072,"labels":2073,"number":1987,"owner":1988,"repository":2010,"state":2011,"title":2074,"updated_at":2075,"url":2076,"score":1994},"It would be really good to know why using `@nuxt/test-utils` is more beneficial than using `@vue/test-utils` in a Nuxt project. Despite the obvious point being this package is made specifically for Nuxt, `@vue/test-utils` still works perfectly well in Nuxt projects.\r\n\r\nCould we get some comparison docs (a table maybe) of what `@vue/test-utils` can't do for a Nuxt project, but `@nuxt/test-utils` can?",[],"@nuxt/test-utils vs @vue/test-utils?","2023-12-02T00:13:11Z","https://github.com/nuxt/test-utils/issues/447",["Reactive",2078],{},["Set"],["ShallowReactive",2081],{"TRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"4RXBQyyWplSblvJRgtlo62Qu52-j7CKYFo3I6-Jl7fM":-1},"/nuxt/nuxt.com/311"]