Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No refetch after changing query parameters #343

Open
dkd-lehnebach opened this issue Oct 30, 2024 · 1 comment
Open

No refetch after changing query parameters #343

dkd-lehnebach opened this issue Oct 30, 2024 · 1 comment

Comments

@dkd-lehnebach
Copy link

I'm currently integrating solr into a nuxt-typo3 project and i'm facing
the following problem:

async submit() {
  await navigateTo({
     query: {
      'tx_solr[q]': this.searchTerm
    },
    replace: true
  })
},

When i trigger the submit function, the url in the address bar changes but
the data from TYPO3 is not refetched. Only when i hit the browser reload button
the data will be loaded.

To get it running I'm temporary using reloadNuxtApp() instead of navigateTo()

reloadNuxtApp({
  path: '?tx_solr[q]='+this.searchTerm
 });
@mercs600
Copy link
Contributor

mercs600 commented Nov 29, 2024

Hi @dkd-lehnebach, you can add a watcher for the route query at the page level to refresh pageData.

<template>
  <T3BackendLayout
    v-if="pageData?.content"
    :name="backendLayout"
    :content="pageData.content"
  />
</template>

<script setup lang="ts">
const { headData, pageData, backendLayout, getPageData } = await useT3Page()
useHead(headData)
const route = useRoute()

watch(() => route.query, async () => {
  await getPageData(route.fullPath)
})

</script>

To achieve this, you need to override our dynamic page. Refer to the documentation here: -> https://t3headless.macopedia.io/nuxt-typo3/guide/override-page#step-1-create-a-new-slugvue-file
We will explore ways to handle this at the library level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants