Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador Video
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
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador Video
Commits
cc832a02
Commit
cc832a02
authored
Feb 15, 2019
by
Chris Beer
Browse files
Options
Downloads
Patches
Plain Diff
Eliminate some full re-renders when the mosaic state is changed
parent
d6b0d677
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/WorkspaceMosaic.js
+4
-2
4 additions, 2 deletions
src/components/WorkspaceMosaic.js
with
4 additions
and
2 deletions
src/components/WorkspaceMosaic.js
+
4
−
2
View file @
cc832a02
...
...
@@ -20,6 +20,7 @@ class WorkspaceMosaic extends React.Component {
this
.
tileRenderer
=
this
.
tileRenderer
.
bind
(
this
);
this
.
mosaicChange
=
this
.
mosaicChange
.
bind
(
this
);
this
.
determineWorkspaceLayout
=
this
.
determineWorkspaceLayout
.
bind
(
this
);
this
.
zeroStateView
=
<
div
/>
;
}
/**
...
...
@@ -51,7 +52,7 @@ class WorkspaceMosaic extends React.Component {
* this render. When the Mosaic changes, that will trigger a new store update.
*/
determineWorkspaceLayout
()
{
const
{
windows
,
workspace
}
=
this
.
props
;
const
{
windows
,
workspace
,
updateWorkspaceMosaicLayout
}
=
this
.
props
;
const
windowKeys
=
Object
.
keys
(
windows
).
sort
();
const
leaveKeys
=
getLeaves
(
workspace
.
layout
);
// Check every window is in the layout, and all layout windows are present
...
...
@@ -59,6 +60,7 @@ class WorkspaceMosaic extends React.Component {
if
(
!
windowKeys
.
every
(
e
=>
leaveKeys
.
includes
(
e
))
||
!
leaveKeys
.
every
(
e
=>
windowKeys
.
includes
(
e
)))
{
const
newLayout
=
createBalancedTreeFromLeaves
(
windowKeys
);
updateWorkspaceMosaicLayout
(
newLayout
);
return
newLayout
;
}
return
null
;
...
...
@@ -75,7 +77,7 @@ class WorkspaceMosaic extends React.Component {
initialValue
=
{
newLayout
||
workspace
.
layout
}
onChange
=
{
this
.
mosaicChange
}
className
=
"
mirador-mosaic
"
zeroStateView
=
{
<
div
/>
}
zeroStateView
=
{
this
.
zeroStateView
}
/
>
);
}
...
...
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