Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
C3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Emil Svevar
C3
Commits
84173f3d
Commit
84173f3d
authored
1 year ago
by
Benjamin Åstrand
Browse files
Options
Downloads
Patches
Plain Diff
Cached improvementWorks on homePage and profilePage
parent
777bc613
No related branches found
No related tags found
1 merge request
!239
Faster card loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/homePage.ts
+20
-2
20 additions, 2 deletions
client/homePage.ts
client/profilePage.ts
+1
-1
1 addition, 1 deletion
client/profilePage.ts
with
21 additions
and
3 deletions
client/homePage.ts
+
20
−
2
View file @
84173f3d
...
...
@@ -37,6 +37,8 @@ interface Project {
let
myIdeaCards
:
{
[
key
:
number
]:
IdeaCard
}
=
{};
const
cache
:
{[
key
:
string
]:
any
[]}
=
{};
class
IdeaCard
{
private
header
:
string
;
private
department
:
string
;
...
...
@@ -323,7 +325,9 @@ export async function loadPage(listenersLoaded: boolean) {
}
const
projectContainer
=
document
.
getElementById
(
"
project-container
"
);
if
(
projectContainer
)
{
await
getProjects
(
projectContainer
,
listenersLoaded
,
user
.
id
);
const
startGetProjects
=
performance
.
now
();
getProjects
(
projectContainer
,
listenersLoaded
,
user
.
id
);
console
.
log
(
`getProjects duration:
${
performance
.
now
()
-
startGetProjects
}
ms`
)
}
console
.
log
(
"
innan
"
);
const
departmentContainer
=
document
.
getElementById
(
...
...
@@ -490,7 +494,19 @@ export async function getProjects(
listenersLoaded
:
boolean
,
userHsaId
:
string
)
{
const
data
=
await
getImprovementWorksForUser
(
userHsaId
);
let
data
:
any
[]
=
[];
if
(
cache
[
userHsaId
])
{
const
startGetCachedProjects
=
performance
.
now
();
data
=
cache
[
userHsaId
];
console
.
log
(
`getCachedProjects duration:
${
performance
.
now
()
-
startGetCachedProjects
}
ms`
);
}
else
{
const
startGetImprovementWorksForUser
=
performance
.
now
();
data
=
await
getImprovementWorksForUser
(
userHsaId
);
cache
[
userHsaId
]
=
data
;
console
.
log
(
`getImprovementWorksForUser duration:
${
performance
.
now
()
-
startGetImprovementWorksForUser
}
ms`
);
}
let
id
=
0
;
data
.
forEach
(
async
(
project
)
=>
{
let
title
=
project
.
name
;
...
...
@@ -511,7 +527,9 @@ export async function getProjects(
dateStarted
);
projectCards
[
i
]
=
card
;
const
startGenerateHTML
=
performance
.
now
();
let
cardHTML
=
card
.
generateHTML
();
console
.
log
(
`GenerateHTML duration
${
performance
.
now
()
-
startGenerateHTML
}
ms`
);
let
div
=
document
.
createElement
(
"
div
"
);
div
.
className
=
"
homePageProjectCardDiv
"
;
// Set the class name(s) here
div
.
innerHTML
=
cardHTML
;
...
...
This diff is collapsed.
Click to expand it.
client/profilePage.ts
+
1
−
1
View file @
84173f3d
...
...
@@ -259,7 +259,7 @@ async function createNewIdeaCard(
}
const
projectContainer
=
document
.
getElementById
(
"
project-container
"
);
if
(
projectContainer
)
{
await
getProjects
(
projectContainer
,
listenersLoaded
,
user
.
id
);
getProjects
(
projectContainer
,
listenersLoaded
,
user
.
id
);
}
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment