",[2023],{"name":1985,"color":2024},"a2eeef","scripts","Add configuration options for fetch timeout, fetch retries and retry delays","2025-02-07T02:36:55Z","https://github.com/nuxt/scripts/issues/347",{"description":2030,"labels":2031,"number":2035,"owner":1988,"repository":1988,"state":1990,"title":2036,"updated_at":2037,"url":2038,"score":2039},"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>",[2032],{"name":2033,"color":2034},"2.x","d4c5f9",1134,"asyncData reverting after data modified","2023-01-18T15:40:52Z","https://github.com/nuxt/nuxt/issues/1134",0.7726582,{"description":2041,"labels":2042,"number":2046,"owner":1988,"repository":1989,"state":1990,"title":2047,"updated_at":2048,"url":2049,"score":2050},"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",[2043],{"name":2044,"color":2045},"bug","ff281a",447,"The `computedFiles` does not handle cache management complex combinations","2023-02-15T12:31:27Z","https://github.com/nuxt/nuxt.com/issues/447",0.7747319,{"description":2052,"labels":2053,"number":2046,"owner":1988,"repository":2025,"state":1990,"title":2057,"updated_at":2058,"url":2059,"score":2050},"### 📚 Is your documentation request related to a problem?\n\nHey, how would I go about accessing a script that is included by Google Tag Manager? I am trying to install PostHog trough GTM (https://posthog.com/docs/libraries/google-tag-manager).\n\nThe script gets successfully added, but I cannot find a way to use the \"injected\" `window.posthog`.\n\nIn the documentation I found `useScript()`, but afaik it needs an URL for the script and I am worried it will load it again. Also, I dont see a way to access it from `useScriptGoogleTagManager()`.\n\nWhat would be the intended way to call `window.posthog`? Thanks\n\n### 🔍 Where should you find it?\n\nhttps://scripts.nuxt.com/scripts/tracking/google-tag-manager\n\n### ℹ️ Additional context\n\n_No response_",[2054],{"name":2055,"color":2056},"documentation","0075ca","Accessing scripts included by Google Tag Manager","2025-04-16T07:39:12Z","https://github.com/nuxt/scripts/issues/447",{"description":2061,"labels":2062,"number":2046,"owner":1988,"repository":2063,"state":1990,"title":2064,"updated_at":2065,"url":2066,"score":2050},"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?",[],"test-utils","@nuxt/test-utils vs @vue/test-utils?","2023-12-02T00:13:11Z","https://github.com/nuxt/test-utils/issues/447",{"description":2068,"labels":2069,"number":2073,"owner":1988,"repository":1988,"state":1990,"title":2074,"updated_at":2075,"url":2076,"score":2077},"### Environment\n\n------------------------------\r\n- Operating System: Darwin\r\n- Node Version: v20.9.0\r\n- Nuxt Version: 3.11.2\r\n- CLI Version: 3.11.1\r\n- Nitro Version: 2.9.6\r\n- Package Manager: npm@10.1.0\r\n- Builder: -\r\n- User Config: devtools\r\n- Runtime Modules: -\r\n- Build Modules: -\r\n------------------------------\n\n### Reproduction\n\nhttps://stackblitz.com/edit/github-57k4ba-aqkyrc?file=app.vue\r\n- Different response when initializing.\r\n- Click button then update param to 'new'\r\n- Both components' responses are updated to 'new'.\n\n### Describe the bug\n\nThe useFetch[post] within the components is parameterized based on props. While both components pass different parameters through props, when updating the props, the response for both components is updated to the same one.\n\n### Additional context\n\nIt's strange that useFetch[get] doesn't exhibit the same behavior. Here's the link: https://stackblitz.com/edit/github-57k4ba-ddzfhp?file=components%2FFetchGet.vue.\n\n### Logs\n\n_No response_",[2070],{"name":2071,"color":2072},"pending triage","E99695",26733,"When using useFetch[post], response data will be bound to the same one.","2025-04-14T16:04:49Z","https://github.com/nuxt/nuxt/issues/26733",0.7748281,["Reactive",2079],{},["Set"],["ShallowReactive",2082],{"TRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"HYI21rmDxg0O8IZfRJUKkH7rm7r2yNMgbhyIK3GsK80":-1},"/nuxt/test-utils/311"]