Check invariant name of custom listview (#10813)

* Check invariant name of custom listview

* Update prefix value
This commit is contained in:
Bjarne Fyrstenborg
2021-08-10 01:29:30 +02:00
committed by GitHub
parent 1dd75b9051
commit 2dadfc2990

View File

@@ -7,8 +7,17 @@
scope.dataType = {};
scope.customListViewCreated = false;
const listViewPrefix = "List View - ";
const checkForCustomListView = () => scope.dataType.name === "List View - " + scope.modelAlias;
const checkForCustomListView = () => invariantEquals(scope.dataType.name, listViewPrefix + scope.modelAlias);
// We also use "localeCompare" a few other places. Should probably be moved to a utility/helper function in future.
function invariantEquals(a, b) {
return typeof a === "string" && typeof b === "string"
? a.localeCompare(b, undefined, { sensitivity: "base" }) === 0
: a === b;
}
/* ---------- INIT ---------- */