Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
32d7a4d3
Unverified
Commit
32d7a4d3
authored
Apr 21, 2020
by
Ryan McKinley
Committed by
GitHub
Apr 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TablePanel: avoid toArray for memoizedData (#23744)
parent
1ca3ce59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
+12
-1
packages/grafana-ui/src/components/Table/Table.tsx
+12
-1
No files found.
packages/grafana-ui/src/components/Table/Table.tsx
View file @
32d7a4d3
...
@@ -72,7 +72,18 @@ export const Table: FC<Props> = memo((props: Props) => {
...
@@ -72,7 +72,18 @@ export const Table: FC<Props> = memo((props: Props) => {
// React table data array. This data acts just like a dummy array to let react-table know how many rows exist
// React table data array. This data acts just like a dummy array to let react-table know how many rows exist
// The cells use the field to look up values
// The cells use the field to look up values
const
memoizedData
=
useMemo
(()
=>
{
const
memoizedData
=
useMemo
(()
=>
{
return
data
.
fields
.
length
>
0
?
data
.
fields
[
0
].
values
.
toArray
()
:
[];
if
(
!
data
.
fields
.
length
)
{
return
[];
}
// Check if an array buffer already exists
const
buffer
=
(
data
.
fields
[
0
].
values
as
any
).
buffer
;
if
(
Array
.
isArray
(
buffer
)
&&
buffer
.
length
===
data
.
length
)
{
return
buffer
;
}
// For arrow tables, the `toArray` implementation is expensive and akward *especially* for timestamps
return
Array
(
data
.
length
).
fill
(
0
);
},
[
data
]);
},
[
data
]);
// React-table column definitions
// React-table column definitions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment