Skip to content

Commit 12e05e9

Browse files
jasonvargawaldemar-pclaude
authored
[6.x] Debounce LinkFieldtype URL writes (#14584)
Co-authored-by: Waldemar Pankratz <waldemar.pankratz@voll.digital> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c5f0eb0 commit 12e05e9

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

resources/js/components/fieldtypes/LinkFieldtype.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
<script>
4141
import Fieldtype from './Fieldtype.vue';
4242
import { Input, Select } from '@/components/ui';
43+
import debounce from '@/util/debounce.js';
44+
import { markRaw } from 'vue';
4345
4446
export default {
4547
components: { Input, Text, Select },
@@ -60,6 +62,13 @@ export default {
6062
};
6163
},
6264
65+
created() {
66+
this.syncUrlDebounced = markRaw(debounce((url) => {
67+
this.update(url);
68+
this.updateMeta({ ...this.meta, initialUrl: url });
69+
}, 150));
70+
},
71+
6372
computed: {
6473
entryValue() {
6574
return this.selectedEntries.length ? `entry::${this.selectedEntries[0]}` : null;
@@ -116,12 +125,11 @@ export default {
116125
117126
urlValue(url) {
118127
if (this.metaChanging) return;
119-
120-
this.update(url);
121-
this.updateMeta({ ...this.meta, initialUrl: url });
128+
this.syncUrlDebounced(url);
122129
},
123130
124131
meta(meta, oldMeta) {
132+
if (meta === oldMeta) return;
125133
if (JSON.stringify(meta) === JSON.stringify(oldMeta)) return;
126134
127135
this.metaChanging = true;

0 commit comments

Comments
 (0)