Skip to content

Commit 83738ba

Browse files
authored
Show the banner if there's a new message (even if the message contents did not change) (#1352)
1 parent 4b4ca45 commit 83738ba

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<script setup>
2-
import { computed, ref, watch } from 'vue';
2+
import {ref, watchEffect} from 'vue';
33
import { usePage } from '@inertiajs/vue3';
44
55
const show = ref(true);
6-
const style = computed(() => usePage().props.jetstream.flash?.bannerStyle || 'success');
7-
const message = computed(() => usePage().props.jetstream.flash?.banner || '');
6+
const style = ref('success');
7+
const message = ref('');
88
9-
watch(message, async () => {
10-
show.value = true;
9+
watchEffect(async () => {
10+
style.value = usePage().props.jetstream.flash?.bannerStyle || 'success';
11+
message.value = usePage().props.jetstream.flash?.banner || '';
12+
show.value = true;
1113
});
1214
</script>
1315

0 commit comments

Comments
 (0)