Skip to content

Commit fe20bc2

Browse files
committed
Fix reduced animation setting not working inside mutation form
1 parent b0469a3 commit fe20bc2

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

src/App.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
<script setup>
2929
import { computed, onMounted } from 'vue'
3030
import { useRoute } from 'vue-router'
31-
import { useJobTheme, useReducedAnimation } from '@/composables/localStorage'
31+
import { useJobTheme } from '@/composables/localStorage'
32+
import { useDynamicVuetifyDefaults } from '@/plugins/vuetify'
3233
3334
const DEFAULT_LAYOUT = 'empty'
3435
const route = useRoute()
@@ -39,14 +40,7 @@ const showSidebar = computed(() => route.meta.showSidebar ?? true)
3940
4041
const jobTheme = useJobTheme()
4142
42-
const reducedAnimation = useReducedAnimation()
43-
44-
const vuetifyDefaults = computed(() => ({
45-
global: {
46-
transition: reducedAnimation.value ? 'no' : undefined,
47-
ripple: reducedAnimation.value ? false : undefined,
48-
}
49-
}))
43+
const vuetifyDefaults = useDynamicVuetifyDefaults()
5044
5145
onMounted(() => {
5246
// apply stored application font-size

src/components/cylc/Mutation.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
-->
1717

1818
<template>
19+
<!-- Have to repeat these defaults as the ones set in App.vue don't make it through
20+
the parent v-dialog - see https://github.com/vuetifyjs/vuetify/issues/18123 -->
21+
<v-defaults-provider :defaults="vuetifyDefaults">
1922
<v-card>
2023
<!-- the mutation title -->
2124
<v-card-title class="py-3">
@@ -121,6 +124,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
121124
</template>
122125
</v-snackbar>
123126
</v-card>
127+
</v-defaults-provider>
124128
</template>
125129

126130
<script>
@@ -133,6 +137,7 @@ import {
133137
mutationStatus
134138
} from '@/utils/aotf'
135139
import { mdiClose } from '@mdi/js'
140+
import { useDynamicVuetifyDefaults } from '@/plugins/vuetify'
136141
137142
export default {
138143
name: 'mutation',
@@ -171,6 +176,14 @@ export default {
171176
},
172177
},
173178
179+
setup () {
180+
const vuetifyDefaults = useDynamicVuetifyDefaults()
181+
182+
return {
183+
vuetifyDefaults,
184+
}
185+
},
186+
174187
data: () => ({
175188
isValid: false,
176189
submitting: false,

src/plugins/vuetify.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
import { computed } from 'vue'
1819
import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'
1920
import { VAutocomplete } from 'vuetify/components/VAutocomplete'
2021
import { VCombobox } from 'vuetify/components/VCombobox'
@@ -23,6 +24,7 @@ import { VTextarea } from 'vuetify/components/VTextarea'
2324
import { VTextField } from 'vuetify/components/VTextField'
2425
import colors from 'vuetify/util/colors'
2526
import { mdiClose } from '@mdi/js'
27+
import { useReducedAnimation } from '@/composables/localStorage'
2628

2729
const inputDefaults = Object.fromEntries([
2830
VAutocomplete,
@@ -76,3 +78,20 @@ export const vuetifyOptions = {
7678
...inputDefaults
7779
},
7880
}
81+
82+
/**
83+
* Composable that provides Vuetify defaults that can change at runtime, as opposed to
84+
* the static defaults provided in `createVuetify(vuetifyOptions)`.
85+
*
86+
* For use with a v-defaults-provider.
87+
*/
88+
export function useDynamicVuetifyDefaults () {
89+
const reducedAnimation = useReducedAnimation()
90+
91+
return computed(() => ({
92+
global: {
93+
transition: reducedAnimation.value ? 'no' : undefined,
94+
ripple: reducedAnimation.value ? false : undefined,
95+
}
96+
}))
97+
}

0 commit comments

Comments
 (0)