You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
Excited for a new version of this library with some possible improvements. Just wanted to make a few recommendations:
A "non-mixin" way of doing $keepSharedElementAlive. For example:
import { ref, onMounted, onActivated } from 'vue'
// by convention, composable function names start with "use"
export function useSharedElementKeepAlive() {
// state encapsulated and managed by the composable
const sharedElementTriggers = ref([]);
const sharedElementFirstRender = ref(true);
onMounted(() => {
sharedElementTriggers.value.forEach((trigger) => {
return trigger();
});
});
onActivated(() => {
if (sharedElementFirstRender.value) {
return (sharedElementFirstRender.value = false);
}
sharedElementTriggers.value.forEach((trigger) => {
return trigger();
});
});
function keepSharedElementAlive(trigger) {
sharedElementTriggers.value.push(trigger);
}
// expose managed state as return value
return {
keepSharedElementAlive,
};
}
Could then be used in setup() more nicely. Keep in mind there is a potential bug with this implementation (that also exists in the current mixin as well): vuejs/core#7276
A way to use this library without vue-router
A way to enable/disable by parameter on the directive (e.g. v-shared-element="{disabled: true}")
The text was updated successfully, but these errors were encountered:
One more clarification to the disabled parameter would be handling onUpdated hook as well (in case duration, argument id, etc. changes... obviously having disabled: true doesn't make much sense if it isn't dynamic)
I really like these ideas. I can't do much with it right now but as soon as I can get some free time I will look more into it as well as Nuxt 3 support
Hey,
Excited for a new version of this library with some possible improvements. Just wanted to make a few recommendations:
Could then be used in setup() more nicely. Keep in mind there is a potential bug with this implementation (that also exists in the current mixin as well): vuejs/core#7276
A way to use this library without vue-router
A way to enable/disable by parameter on the directive (e.g. v-shared-element="{disabled: true}")
The text was updated successfully, but these errors were encountered: