Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
project2-it2810
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mikkel Marstein
project2-it2810
Commits
c083a426
Verified
Commit
c083a426
authored
3 years ago
by
Ulrik Røsby
Browse files
Options
Downloads
Patches
Plain Diff
fix: Remove uneeded remove func from useStorage
parent
dcc20acf
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/helpers/hooks.ts
+4
-8
4 additions, 8 deletions
src/helpers/hooks.ts
src/pages/FeatsVsFixesPage/index.tsx
+2
-2
2 additions, 2 deletions
src/pages/FeatsVsFixesPage/index.tsx
src/pages/TimePerIssueLabelPage/index.tsx
+0
-1
0 additions, 1 deletion
src/pages/TimePerIssueLabelPage/index.tsx
with
6 additions
and
11 deletions
src/helpers/hooks.ts
+
4
−
8
View file @
c083a426
import
{
Dispatch
,
SetStateAction
,
useCallback
,
useEffect
,
useState
}
from
'
react
'
;
import
{
Dispatch
,
SetStateAction
,
useEffect
,
useState
}
from
'
react
'
;
type
StorageObject
=
typeof
window
.
localStorage
|
typeof
window
.
sessionStorage
;
type
StorageObject
=
typeof
window
.
localStorage
|
typeof
window
.
sessionStorage
;
// useStorage, useLocalStorage and useSessionStorage is taken from:
// useStorage, useLocalStorage and useSessionStorage is taken from:
...
@@ -14,8 +14,8 @@ function useStorage<ValueType>(
...
@@ -14,8 +14,8 @@ function useStorage<ValueType>(
key
:
string
,
key
:
string
,
defaultValue
:
ValueType
,
defaultValue
:
ValueType
,
storageObject
:
StorageObject
,
storageObject
:
StorageObject
,
):
[
ValueType
|
undefined
,
Dispatch
<
SetStateAction
<
ValueType
|
undefined
>>
,
()
=>
void
]
{
):
[
ValueType
,
Dispatch
<
SetStateAction
<
ValueType
>>
]
{
const
[
value
,
setValue
]
=
useState
<
ValueType
|
undefined
>
(()
=>
{
const
[
value
,
setValue
]
=
useState
<
ValueType
>
(()
=>
{
const
jsonValue
=
storageObject
.
getItem
(
key
);
const
jsonValue
=
storageObject
.
getItem
(
key
);
if
(
jsonValue
!=
null
)
return
JSON
.
parse
(
jsonValue
);
if
(
jsonValue
!=
null
)
return
JSON
.
parse
(
jsonValue
);
return
defaultValue
;
return
defaultValue
;
...
@@ -26,11 +26,7 @@ function useStorage<ValueType>(
...
@@ -26,11 +26,7 @@ function useStorage<ValueType>(
storageObject
.
setItem
(
key
,
JSON
.
stringify
(
value
));
storageObject
.
setItem
(
key
,
JSON
.
stringify
(
value
));
},
[
key
,
value
,
storageObject
]);
},
[
key
,
value
,
storageObject
]);
const
remove
=
useCallback
(()
=>
{
return
[
value
,
setValue
];
setValue
(
undefined
);
},
[]);
return
[
value
,
setValue
,
remove
];
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/pages/FeatsVsFixesPage/index.tsx
+
2
−
2
View file @
c083a426
...
@@ -27,7 +27,7 @@ export default function FeatsVsFixesPage() {
...
@@ -27,7 +27,7 @@ export default function FeatsVsFixesPage() {
];
];
for
(
let
i
=
0
;
i
<
authorData
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
authorData
.
length
;
i
++
)
{
if
(
selectedAuthors
?.
[
i
])
{
if
(
selectedAuthors
[
i
])
{
featsFixesGraphData
[
0
].
val
+=
authorData
[
i
].
feats
;
featsFixesGraphData
[
0
].
val
+=
authorData
[
i
].
feats
;
featsFixesGraphData
[
1
].
val
+=
authorData
[
i
].
fixes
;
featsFixesGraphData
[
1
].
val
+=
authorData
[
i
].
fixes
;
additionsDeletionsGraphData
[
0
].
val
+=
authorData
[
i
].
additions
;
additionsDeletionsGraphData
[
0
].
val
+=
authorData
[
i
].
additions
;
...
@@ -54,7 +54,7 @@ export default function FeatsVsFixesPage() {
...
@@ -54,7 +54,7 @@ export default function FeatsVsFixesPage() {
<
div
key
=
{
JSON
.
stringify
(
m
)
}
>
<
div
key
=
{
JSON
.
stringify
(
m
)
}
>
Person
{
i
+
1
}
Person
{
i
+
1
}
<
Checkbox
<
Checkbox
checked
=
{
selectedAuthors
?.
[
i
]
}
checked
=
{
selectedAuthors
[
i
]
}
onChange
=
{
()
=>
{
onChange
=
{
()
=>
{
if
(
!
selectedAuthors
)
return
;
// selectedAuthors will never be undefined
if
(
!
selectedAuthors
)
return
;
// selectedAuthors will never be undefined
const
tempList
=
[...
selectedAuthors
];
const
tempList
=
[...
selectedAuthors
];
...
...
This diff is collapsed.
Click to expand it.
src/pages/TimePerIssueLabelPage/index.tsx
+
0
−
1
View file @
c083a426
...
@@ -37,7 +37,6 @@ export default function TimePerIssueLabelPage() {
...
@@ -37,7 +37,6 @@ export default function TimePerIssueLabelPage() {
useEffect
(()
=>
{
useEffect
(()
=>
{
// If allIssueData or selected is null, something is not selected and or the data is not
// If allIssueData or selected is null, something is not selected and or the data is not
if
(
allIssueData
==
null
)
return
;
if
(
allIssueData
==
null
)
return
;
if
(
selected
==
null
)
return
;
// Find the average time used to close an issue with one of the selected labels
// Find the average time used to close an issue with one of the selected labels
const
selectedArray
=
JSON
.
parse
(
selected
);
const
selectedArray
=
JSON
.
parse
(
selected
);
...
...
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