Merge branch 'develop' into dist/ubuntu/bionic/develop

This commit is contained in:
wpetit 2020-04-30 17:28:42 +02:00
commit 164377ec08

View File

@ -75,13 +75,13 @@ function createCards(projects: Project[], issues: any, lane: BoardLane, rest: Se
return projectIssues.reduce((projectCards: KanboardCard[], issue: any) => {
const hasLabel = issue.labels.some((l: any) => l.name === lane.issueLabel);
const card = getMemoizedKanboardCard(issue.id, issue.title, p, issue);
const { card, memoized } = getMemoizedKanboardCard(issue.id, issue.title, p, issue);
if (hasLabel) {
projectCards.push(card);
rest.delete(card);
} else {
rest.add(card);
if (!memoized) rest.add(card);
}
return projectCards;
@ -95,11 +95,19 @@ function createCards(projects: Project[], issues: any, lane: BoardLane, rest: Se
const kanboardCardMemo: {[key: string]: KanboardCard} = {};
function getMemoizedKanboardCard(id: number, title: string, project: Project, issue: Issue): KanboardCard {
const key = `${project.id}-${issue.id}-${id}`;
if (kanboardCardMemo.hasOwnProperty(key)) return kanboardCardMemo[key];
function getKanboardCardMemoizationKey(id: number, project: Project, issue: Issue) {
return `${project.id}-${issue.id}-${id}`;
}
function isKanboardCardMemoized(key: string) {
return kanboardCardMemo.hasOwnProperty(key)
}
function getMemoizedKanboardCard(id: number, title: string, project: Project, issue: Issue) {
const key = getKanboardCardMemoizationKey(id, project, issue);
if (isKanboardCardMemoized(key)) return { card: kanboardCardMemo[key], memoized: true };
kanboardCardMemo[key] = { id, title, project, issue };
return kanboardCardMemo[key];
return { card: kanboardCardMemo[key], memoized: false };
}
function resetKandboarCardMemo() {