mirror of
https://github.com/directus/directus.git
synced 2026-01-24 08:38:07 -05:00
allow for temporary presets (#4724)
This commit is contained in:
@@ -5,7 +5,7 @@ import { useCollection } from '@/composables/use-collection';
|
||||
|
||||
import { Filter, Preset } from '@/types/';
|
||||
|
||||
export function usePreset(collection: Ref<string>, bookmark: Ref<number | null> = ref(null)) {
|
||||
export function usePreset(collection: Ref<string>, bookmark: Ref<number | null> = ref(null), temporary = false) {
|
||||
const presetsStore = usePresetsStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -29,6 +29,7 @@ export function usePreset(collection: Ref<string>, bookmark: Ref<number | null>
|
||||
* @param preset The preset that should be saved
|
||||
*/
|
||||
const savePreset = async (preset?: Partial<Preset>) => {
|
||||
if (temporary) return;
|
||||
busy.value = true;
|
||||
|
||||
const updatedValues = await presetsStore.savePreset(preset ? preset : localPreset.value);
|
||||
|
||||
@@ -70,7 +70,7 @@ export default defineComponent({
|
||||
const { collection } = toRefs(props);
|
||||
|
||||
const { info: collectionInfo } = useCollection(collection);
|
||||
const { layout, layoutOptions, layoutQuery, searchQuery } = usePreset(collection);
|
||||
const { layout, layoutOptions, layoutQuery, searchQuery } = usePreset(collection, ref(null), true);
|
||||
|
||||
// This is a local copy of the layout. This means that we can sync it the layout without
|
||||
// having use-preset auto-save the values
|
||||
|
||||
Reference in New Issue
Block a user