appbaseio / appbaseio/reactivesearch

Vue - AutoScrollTop on pagination not working and pageChange event not emitted

Aperta
#1,973 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
JavaScript
Stelle
4.9k
Fork
478
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Affected Projects**
Vue.JS

**Library Version:**
1.29.0

**Describe the bug**

When clicking on a page number, the ReactiveList component should scroll to top (by default) and should send a pageChange event.
In my case, the scroll is not done and I never get the pageChange event.

I think I found the problem in the code of the /packages/vue/src/components/result/ReactiveList.jsx component:

```
hits(newVal, oldVal) {
this.$emit('data', this.getData());
if (this.shouldRenderPagination) {
// called when page is changed
if (this.isLoading && (oldVal || newVal)) {
if (this.hasPageChangeListener) {
this.$emit('pageChange', this.currentPageState + 1, this.totalPages);
this.$emit('page-change', this.currentPageState + 1, this.totalPages);
} else if (this.scrollOnChange) {
window.scrollTo(0, 0);
}
}

```
I can be wrong but I think that the line
`if (this.isLoading && (oldVal || newVal)) {`

should be

`if (!this.isLoading && (oldVal || newVal)) {`

It's missing a NOT before this.isLoading. Else it will never execute the code that is following the condition because the loading is finished since a while at this time.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da packages/vue/src/components/result/ReactiveList.jsx e analizza il watcher di hits e la relativa condizione di caricamento. Riproduci la paginazione con ReactiveList, quindi verifica che il cambio di pagina scorra verso l’alto per impostazione predefinita ed emetta l’evento pageChange.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.