Fixed check for incorrect dynamic bindings (#1775)

* Fixed check for incorrect dynamic bindings
This commit is contained in:
Nidhi 2020-11-18 14:25:55 +05:30 committed by GitHub
parent f36adeb6b5
commit 941be8c58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -17,6 +17,7 @@ public class FieldName {
public static String PLUGIN = "plugin";
public static String DEFAULT_PAGE_NAME = "Page1";
public static String TYPE = "type";
public static final String WIDGET_ID = "widgetId";
public static String WIDGET_NAME = "widgetName";
public static String DYNAMIC_BINDINGS = "dynamicBindings";
public static String DYNAMIC_BINDING_PATH_LIST = "dynamicBindingPathList";

View File

@ -455,10 +455,13 @@ public class LayoutActionServiceImpl implements LayoutActionService {
}
}
if (parent == null) {
throw new AppsmithException(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE, nextKey);
log.error("Unable to find dynamically bound key {} for the widget with id {}", nextKey, dsl.get(FieldName.WIDGET_ID));
break;
}
}
dynamicBindings.addAll(MustacheHelper.extractMustacheKeysFromFields(parent));
if(parent != null) {
dynamicBindings.addAll(MustacheHelper.extractMustacheKeysFromFields(parent));
}
}
}

View File

@ -480,9 +480,13 @@ public class LayoutServiceTest {
StepVerifier
.create(testMono)
.expectErrorMatches(throwable -> throwable instanceof AppsmithException &&
throwable.getMessage().equals(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE.getMessage("dynamicGet_IncorrectKey")))
.verify();
.assertNext(layout -> {
assertThat(layout).isNotNull();
assertThat(layout.getId()).isNotNull();
assertThat(layout.getDsl().get("key")).isEqualTo("value-updated");
assertThat(layout.getLayoutOnLoadActions()).hasSize(0);
})
.verifyComplete();
}
@After