-
Notifications
You must be signed in to change notification settings - Fork 877
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
Migrate Popular view to composition API #6129
Migrate Popular view to composition API #6129
Conversation
Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com>
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.
As we are no longer trapped by the Options API, if the cache is available we can use it directly for the first render, instead of reading it in onMounted and triggering a re-render.
onMounted(() => { | ||
document.addEventListener('keydown', keyboardShortcutHandler) | ||
|
||
shownResults.value = popularCache.value || [] |
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.
shownResults.value = popularCache.value || [] |
const { t } = useI18n() | ||
|
||
const isLoading = ref(false) | ||
const shownResults = shallowRef([]) |
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.
const shownResults = shallowRef([]) |
document.addEventListener('keydown', keyboardShortcutHandler) | ||
|
||
shownResults.value = popularCache.value || [] | ||
if (!shownResults.value || shownResults.value.length < 1) { |
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.
if (!shownResults.value || shownResults.value.length < 1) { | |
if (shownResults.value.length === 0) { |
Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com>
* Migrate Popular to composition API * remove comment, use shallowRef for shownResults Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com> * Optimize setting shownResults Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com> * Fix typo Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --------- Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
Migrate Popular to composition API
Pull Request Type
Description
This pull request migrates the Popular view to the composition API.
Testing
Desktop