Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mirador-video-annotations
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
Show more breadcrumbs
Loïs Poujade
mirador-video-annotations
Commits
d8b1c600
Commit
d8b1c600
authored
3 years ago
by
Frank Bessou
Committed by
Chris Beer
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix unmount not finding container when already detached from document
Closes #3533.
parent
c862d2c1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/src/lib/MiradorViewer.test.js
+7
-0
7 additions, 0 deletions
__tests__/src/lib/MiradorViewer.test.js
src/lib/MiradorViewer.js
+8
-5
8 additions, 5 deletions
src/lib/MiradorViewer.js
with
15 additions
and
5 deletions
__tests__/src/lib/MiradorViewer.test.js
+
7
−
0
View file @
d8b1c600
...
@@ -7,12 +7,19 @@ jest.mock('react-dom');
...
@@ -7,12 +7,19 @@ jest.mock('react-dom');
jest
.
mock
(
'
isomorphic-unfetch
'
,
()
=>
jest
.
fn
(()
=>
Promise
.
resolve
({
json
:
()
=>
({})
})));
jest
.
mock
(
'
isomorphic-unfetch
'
,
()
=>
jest
.
fn
(()
=>
Promise
.
resolve
({
json
:
()
=>
({})
})));
describe
(
'
MiradorViewer
'
,
()
=>
{
describe
(
'
MiradorViewer
'
,
()
=>
{
let
container
;
let
instance
;
let
instance
;
beforeAll
(()
=>
{
beforeAll
(()
=>
{
container
=
document
.
createElement
(
'
div
'
);
container
.
id
=
'
mirador
'
;
document
.
body
.
appendChild
(
container
);
ReactDOM
.
render
=
jest
.
fn
();
ReactDOM
.
render
=
jest
.
fn
();
ReactDOM
.
unmountComponentAtNode
=
jest
.
fn
();
ReactDOM
.
unmountComponentAtNode
=
jest
.
fn
();
instance
=
new
MiradorViewer
({
id
:
'
mirador
'
});
instance
=
new
MiradorViewer
({
id
:
'
mirador
'
});
});
});
afterAll
(()
=>
{
document
.
body
.
removeChild
(
container
);
});
describe
(
'
constructor
'
,
()
=>
{
describe
(
'
constructor
'
,
()
=>
{
it
(
'
returns viewer store
'
,
()
=>
{
it
(
'
returns viewer store
'
,
()
=>
{
expect
(
instance
.
store
.
dispatch
).
toBeDefined
();
expect
(
instance
.
store
.
dispatch
).
toBeDefined
();
...
...
This diff is collapsed.
Click to expand it.
src/lib/MiradorViewer.js
+
8
−
5
View file @
d8b1c600
...
@@ -19,11 +19,14 @@ class MiradorViewer {
...
@@ -19,11 +19,14 @@ class MiradorViewer {
this
.
store
=
viewerConfig
.
store
this
.
store
=
viewerConfig
.
store
||
createPluggableStore
(
this
.
config
,
this
.
plugins
);
||
createPluggableStore
(
this
.
config
,
this
.
plugins
);
if
(
config
.
id
)
{
this
.
container
=
document
.
getElementById
(
config
.
id
);
config
.
id
&&
ReactDOM
.
render
(
config
.
id
&&
ReactDOM
.
render
(
this
.
render
(),
this
.
render
(),
document
.
getElementById
(
config
.
id
)
,
this
.
container
,
);
);
}
}
}
/**
/**
* Render the mirador viewer
* Render the mirador viewer
...
@@ -40,7 +43,7 @@ class MiradorViewer {
...
@@ -40,7 +43,7 @@ class MiradorViewer {
* Cleanup method to unmount Mirador from the dom
* Cleanup method to unmount Mirador from the dom
*/
*/
unmount
()
{
unmount
()
{
this
.
con
fig
.
id
&&
ReactDOM
.
unmountComponentAtNode
(
document
.
getElementById
(
this
.
con
fig
.
id
)
);
this
.
con
tainer
&&
ReactDOM
.
unmountComponentAtNode
(
this
.
con
tainer
);
}
}
}
}
...
...
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