Skip to content

Commit 6660ede

Browse files
authored
Fix memory leak and potential caching issue with usePage (#1366)
1 parent a572879 commit 6660ede

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

stubs/inertia/resources/js/Components/Banner.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup>
2-
import {ref, watchEffect} from 'vue';
2+
import { ref, watchEffect } from 'vue';
33
import { usePage } from '@inertiajs/vue3';
44
5+
const page = usePage();
56
const show = ref(true);
67
const style = ref('success');
78
const message = ref('');
89
910
watchEffect(async () => {
10-
style.value = usePage().props.jetstream.flash?.bannerStyle || 'success';
11-
message.value = usePage().props.jetstream.flash?.banner || '';
11+
style.value = page.props.jetstream.flash?.bannerStyle || 'success';
12+
message.value = page.props.jetstream.flash?.banner || '';
1213
show.value = true;
1314
});
1415
</script>

stubs/inertia/resources/js/Pages/Profile/Partials/TwoFactorAuthenticationForm.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const props = defineProps({
1414
requiresConfirmation: Boolean,
1515
});
1616
17+
const page = usePage();
1718
const enabling = ref(false);
1819
const confirming = ref(false);
1920
const disabling = ref(false);
@@ -26,7 +27,7 @@ const confirmationForm = useForm({
2627
});
2728
2829
const twoFactorEnabled = computed(
29-
() => ! enabling.value && usePage().props.auth.user?.two_factor_enabled,
30+
() => ! enabling.value && page.props.auth.user?.two_factor_enabled,
3031
);
3132
3233
watch(twoFactorEnabled, () => {

stubs/inertia/resources/js/Pages/Teams/Partials/TeamMemberManager.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const props = defineProps({
2020
userPermissions: Object,
2121
});
2222
23+
const page = usePage();
24+
2325
const addTeamMemberForm = useForm({
2426
email: '',
2527
role: null,
@@ -69,7 +71,7 @@ const confirmLeavingTeam = () => {
6971
};
7072
7173
const leaveTeam = () => {
72-
leaveTeamForm.delete(route('team-members.destroy', [props.team, usePage().props.auth.user]));
74+
leaveTeamForm.delete(route('team-members.destroy', [props.team, page.props.auth.user]));
7375
};
7476
7577
const confirmTeamMemberRemoval = (teamMember) => {

0 commit comments

Comments
 (0)