Skip to content

Commit

Permalink
Check invariant name of custom listview (umbraco#10813)
Browse files Browse the repository at this point in the history
* Check invariant name of custom listview

* Update prefix value
  • Loading branch information
bjarnef authored Aug 9, 2021
1 parent 1dd75b9 commit 2dadfc2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------- */

Expand Down

0 comments on commit 2dadfc2

Please sign in to comment.