Skip to content

Commit 75af125

Browse files
committed
FIX Ensure change tracker not trigger by precence of MultiLinkField
1 parent 988a288 commit 75af125

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

client/dist/js/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/entwine/LinkField.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ jQuery.entwine('ss', ($) => {
2828

2929
refresh() {
3030
const props = this.getProps();
31-
this.getInputField().val(props.value);
31+
// Set the value attribute specifically with a "string" array when using a MultiLinkField
32+
// This is done to ensure the change-tracker works as expected otherwise the intial form state
33+
// will not match the component after it's refreshed, which happens when it's mounted
34+
let value = props.value;
35+
if (value.constructor === Array) {
36+
value = '[' + value.join(',') + ']';
37+
}
38+
this.getInputField().val(value);
3239
const ReactField = this.getComponent();
3340
const Root = this.getRoot();
3441
Root.render(<ReactField {...props} noHolder/>);

0 commit comments

Comments
 (0)