0

I have a very simple dynamic route. The page is in the following directory: ~/pages/explore/initiative/[id].vue

When I navigate to that page via NuxtLink, it seems to be making the request several times.

I added the following code to [id].vue to verify if this is the case

const route = useRoute()
const initiativeId = route.params.id;
console.log("Route Params: ", route.params.id);

Here's an example of the output

Route Params:  18

 WARN  [@vue/server-renderer] Skipped rendering unsafe attribute name: "

Route Params:  preload.js.map

So it seems that the ID is being switched to preload.js.map. I didn't write any code to that switch, so it seems to be the framework making the request or some other package included within.

Not sure if this is relevant, but there's also an index.vue page in ~/pages/explore/initiative/index.vue

1
  • I'm curious to see what else is going on on the page. In any case, just for fun, when troubleshooting, try making the initiativeId a computed: const initiativeId = computed(() =>route.params.id), and then console.log: console.log("Route Params: ", initiativeId.value). Moreover, move the console.log to onMounted and see what happens. Just giving you things to try. Commented Nov 28, 2024 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.