question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v5.31.0

I have an editor which can switch between a basic codemirror and merge view. When I switch from normal to merge and back to normal it appears to leave the merge view hooks in place. If my single page app stays open long enough it take increasingly long periods of time to load the codemirror editor with new code as the hidden merge view is trying to diff. I reset the generation in the codemirror instance when I load new code but merge is left alone.

My request - is there a way to add support to unload MergeView and its hook/timers?

Background: Merge appears to have hooks like timeouts, events and others. Chrome performance dev tools show merge registered timeout events that run for 1 second per each time I open merge diff with different code as I can see more and more merge.js timers showing up in the performance monitor when I run it (each instance locking the ui for 1s). Refreshing the screen fixes it until I start to use the merge features. Here is my code block for how I start the merge view each time a diff is requested by the user:

var target = document.getElementById("view");
target.innerHTML = "";   // Tried with and without this line
var dv = CodeMirror.MergeView(target, {
		value: $scope.codeEditor.linkedDoc({sharedHist:true}),
		origLeft: null,
		orig: $scope.editorMdl.gitCompare.codeStore.code,
		lineNumbers: true,
		highlightDifferences: true,
		connect: "align",
		collapseIdentical: true,
		mode: codingcenterService.getLangsMeta($scope.editorMdl.intrchg.lang).language,
		theme: "neat"
});

Here is the HTML hosting the segment of the spa display: <div ng-hide="visi.codeHide" class="erm-full"> <textarea ui-codemirror="codeOption" ng-model="editorMdl.intrchg.fullCode"></textarea> </div> <div id=view style="height: 100%;" ng-show="visi.codeHide"></div>

Call stack of the issue: Timer in merge.js line 119 (this calls ~x times depending on on how many times I start diff) Calls merge.js:87 and etc…

Possible fixes in merge.js:

  • An “unregister” events function for the materials inside function registerUpdate(dv) on line 83
  • A way to call the clearTimeout(debounceChange); as found on line 117

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marijnhcommented, Mar 15, 2018

Agreed, that’s why I’m guessing now perhaps it might be the shared doc?

Yes, that’d be it. You’ll have to unlink the document in the editor that you’re dropping.

0reactions
tcederquistcommented, Mar 15, 2018

In case someone stumbles on this from google, here is a code extract of the solution @marijnh pointed me at:

var ed = $scope.diffDv.editor();    // Stored from the call $scope.diffDv = CodeMirror.MergeView(target, {...
var doc = ed.getDoc();
doc.iterLinkedDocs((ldoc, shared)=>{ // Iterate over all the linked docs to remove and cleanup the event hooks
	console.log("unlinking doc:", ldoc);
	doc.unlinkDoc(ldoc);
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Example 9: Unload Selected Members, Load, Copy and Merge
In this example, members are selected, excluded, unloaded, loaded, and copied. Processing will occur as follows: unload, excluding members; unload, selecting ...
Read more >
UNLOAD examples - Amazon Redshift - AWS Documentation
Provides examples of how to use the UNLOAD command. ... The following example unloads the results of a join query that contains a...
Read more >
AutoDrive - Unload Combine Feature! | Farming Simulator 22
Farming Simulator 22, How to Video on AutoDrive, and tutorial video. One of the best Mods from FS19 makes a comeback to FS22,...
Read more >
Unload Combine Feature | How To Use AutoDrive Part 5 - FS19
AutoDrive mod, tutorial videos for farming simulator 19, showing the basic controls & Advanced features.In Part 5, I show probably the best ...
Read more >
Unload combine - question about unloading trailer ... - GitHub
Hello, i am using newest CP version and unloading combine works perfect. But, once the trailer is full, what should i do now?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found