-
Notifications
You must be signed in to change notification settings - Fork 10
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
754 les onglets ne sont plus sticky quand on change de route #755
754 les onglets ne sont plus sticky quand on change de route #755
Conversation
onMounted(async () => { | ||
const el = await waitForElement("#sticky-indicator"); | ||
const resizeObserver = new ResizeObserver((entries) => { | ||
stickyTop.value = entries[0].target.clientHeight + "px"; | ||
// Because auditGenerationHeader ref is inside a "v-if", | ||
// Vue will not instantiate the ref immediately. | ||
// We need to watch it before observing nested stickyIndicator | ||
watch(auditGenerationHeader, async () => { | ||
const stickyIndicator = auditGenerationHeader.value?.stickyIndicator; | ||
resizeObserver = new ResizeObserver((entries) => { | ||
stickyTop.value = entries[0].target.clientHeight + "px"; | ||
}); | ||
stickyIndicator && resizeObserver.observe(stickyIndicator); | ||
}); | ||
resizeObserver.observe(el); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a le "droit" de mettre un watch
dans un onMounted
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien vu @hissalht . Je pense que c’est permis, mais clairement inutile et ça devait surement créer un memory leak.
Voir : https://vuejs.org/guide/essentials/watchers#stopping-a-watcher
J’ai simplement enlevé le onMounted
pour ne laisser que le watch
.
Voir 5856a49.
Nickel pour l'ajustement entre le composant "ajout de fichier" et "l'impact usager". En revanche, j'ai noté deux petites choses (je ne sais pas à quoi c'est dû) : |
@AdrienMuzyczka :
|
Ça marche :) |
dc91341
to
d0bd5af
Compare
* expose stickyIndicator from AuditGenerationHeader * watch for ref updates in AuditGenerationPage Note that nested stickyIndicator height is used with 2 sticky divs: filters and tabs
d0bd5af
to
5c40cf8
Compare
8f8d04e
to
5856a49
Compare
No description provided.