mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-12 11:52:50 +02:00
fix: prevent infinite update loop by conditionally sending updates in WrapperField #963
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
### 🐞 Fixes
|
||||
|
||||
- Fix number fields not being saved to front matter when used inside block field groups
|
||||
- [#963](https://github.com/estruyf/vscode-front-matter/issues/963): Prevent infinite update loops for fields when using Hugo partials as values in the front matter
|
||||
- [#1041](https://github.com/estruyf/vscode-front-matter/issues/1041): Fix in image page when using page bundles
|
||||
|
||||
## [10.10.1] - 2026-04-23
|
||||
|
||||
@@ -128,7 +128,12 @@ export const WrapperField: React.FunctionComponent<IWrapperFieldProps> = ({
|
||||
}).then((data) => {
|
||||
if (data.field === field.name) {
|
||||
setFieldValue(data.value);
|
||||
onSendUpdate(field.name, data.value, parentFields);
|
||||
// Only write back if the placeholder was actually resolved to something different,
|
||||
// otherwise values like Hugo shortcodes ({{%...%}}) that contain {{ }} but are
|
||||
// not FM placeholders would cause an infinite update loop.
|
||||
if (data.value !== value) {
|
||||
onSendUpdate(field.name, data.value, parentFields);
|
||||
}
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
|
||||
Reference in New Issue
Block a user