Duplicated previewer when preview watermarked file
- Dominant language
- JavaScript
- Stars
- 120
- Forks
- 137
- Avg merge
- 12h 36m
- Merged PRs (30d)
- 17
Description
Please fill out the following template so we can reproduce and fix your issue as quickly as possible!
**Environment:**
- Preview version: 2.16.0 (latest Box Content Preview version)
**Desktop (please complete the following information):**
- OS: [MacOS]
- Browser [Chrome 75.0.3770.142]
**Steps to reproduce the problem:**
1. Preview file by providing file object to the show method
2. Try to zoom in and zoom out file
3. Try to use aside thumbnails
**What is the expected behavior? (Screenshots can be helpful here)**
Document is properly zoomed and thumbnails sidebar navigation works
**What went wrong? (Screenshots, console logs, or HAR files can be helpful here)**
Document is duplicated, zoom does not work, thumbnails sidebar navigation does not work

**Link to application or sample code:**
[CodePen example](https://codepen.io/Dolgach/pen/VorNav)
You have to generate your own access token to reproduce it in this CodePen, my access token is valid for 1 hour
[Video recording of the issue](https://drive.google.com/file/d/1JeZ7X_zplChy9ztszpImZJX8vOusMKf1/view?usp=sharing)
**Expected behavior**
Document is properly zoomed and thumbnails sidebar navigation works.
**Additional context**
I debugged the source code and from my perspective, problem can be fixed here by calling `this.destroy()` after uncaching watermarked file in `Preview.js` file - [link to the specific line of code](https://github.com/box/box-content-preview/blob/master/src/lib/Preview.js#L1084)
This bug happens only for watermarked files and only when we provide `file` instead of `file id` to the `show()` method.
Contributor guide
Research direction
Start with src/lib/Preview.js at the linked line and reproduce the issue using the CodePen example with a watermarked file passed as a file object to show(). Verify zoom and thumbnail navigation before and after the change; done means the document is rendered once and both controls work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100