Closed HumzahJavid closed 6 years ago
chrome.tabs.onCreated.addListener()
in the browser.js
so the new tab is not added as a new node in historyMap.browser.js
when a node for a closed tab is clicked in historyMap and a new tab opened?Related to #92 Turns out not the case.
Humzah to contact Phong to find out how this was done in the SenseMap (master branch).
Phong's comment from his email
On 27 Jun 2018, at 06:14, Nguyen, Phong Phong.Nguyen.3@city.ac.uk wrote: Hi Kai, This is about the issue in the History Map you mentioned a few days ago. Luckily, the code for this part was well commented. Function
onNodeClicked
https://github.com/Vis4Sense/HistoryMap/blob/master/src/pages/index.js#L439 handles when a node is clicked. You can see in the code two cases are considered: • Found in opening tabs: active the tab, scroll to the captured element (when text/image is highlighted) • Not found: create a new tab and scroll Hope it helps. Cheers, Phong
Hi Phong,
The index.js
is now the historyMap.js
and the onNodeClicked
function is not changed: https://github.com/Vis4Sense/HistoryMap/blob/bffc09f33de3f84c5ddf2af42c6a615e36bdeca1/src/historyMap/historyMap.js#L57
What changed is the tab creation listener in browser.js
, which now creates a new historymap node when a new tab is opened in Chrome: https://github.com/Vis4Sense/HistoryMap/blob/bffc09f33de3f84c5ddf2af42c6a615e36bdeca1/src/historyMap/browser.js#L41
This is different from how the tab creation listener works in the old ‘browser.js’, which I assumes stops it from creating duplicate historyMap node (i.e., the current bug). It will be helpful if you can explain how the old tab creation listener works and then this can be added to the new version.
https://github.com/Vis4Sense/HistoryMap/blob/230877cea5704aae7501997ac5b8ad4433d8de03/src/js/provenance/browser.js#L39
node
object that records whether its tab status
is 'opened' or 'closed';
false
when the node is first created;true
whenever the node is clicked after its creation;onTabCreation
function in browser.js
should check if
The partial fix commit above incorporated logic primarily in browser.js to prevent additional nodes being generated and displayed in historyMap page. This used a clicked status (representing the most recently clicked node) and whether the clicked node was a history map node or an annotation (highlight) node.
Whilst the above logic fixed the issue for clicking history map nodes, it was still present for annotation (highlight) nodes.
The additional nodes were still being created when a highlight node was clicked, the cause was "click-node" nodes being present in historyMap.view.layout.forest().vertices(); these were generated by the following line in redraw function
historyMap.view.redraw = function () {
historyMap.model.tree = listToTree(nodes);
historyMapView.width(window.innerWidth).height(window.innerHeight);
d3.select('.sm-history-map-container').datum(historyMap.model.tree).call(historyMapView);
}
Solution was to add the following line, preventing these nodes from appearing in historyMap.model.tree and in ...forest().vertices() https://github.com/Vis4Sense/HistoryMap/blob/746e5affd0a6a4b7666697dc592af9c75af608e9/src/historyMap/listToTree.js#L63
The issue
What is the issue?
Two additional nodes appear on the history map, when a text/note node is clicked for a node/tab which was previously closed. One of the additional nodes is a node which displays the same favicon/icon and webpage title as the original node, when this node is clicked on it opens a blank "new tab" tab. The other additional node only has no icon/favicon, only displaying the url of the original node, when this node is clicked on it opens the webpage which had the original highlights, with all the highlights in place.
To re-create the issue:
Start the extension, make sure the history map is active. Open any webpage and use any of the annotation features (highlighting text or adding a note to highlighted text). Now close the tab and return to the historymap, click on any of the highlight nodes of the tab which was just closed. The tab will reopen, with all the highlights in place. However on the historymap page the 2 additional nodes will also appear as previously described
The additional nodes as they appear in History Map
Branch and Commit where this issue can be replicated
This issue can be seen in branch rebuild-mvc-historymap-highlights commit c7be9a7 (check earliest commit with issue)