Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 379510

Summary: Parent div for compare widget has to be in the DOM
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: GitAssignee: libing wang <libingw>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: gabriel.luong, libingw, susan
Version: 0.2   
Target Milestone: 4.0 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 379567    

Description Szymon Brandys CLA 2012-05-15 05:09:26 EDT
Forked from bug 379237, comment 4 where Susan said:

	> Moreover the editor is initialized with a timeout to workaround the problem
	> with "the parent div in the DOM". This is just for now before we decide how to
	> solve the root cause of the problem.

We'll probably open a separate bug on this after the fact.

It seems that the 'timeout workaround' works pretty well, however I'll keep this new bug as a blocker for the new git status page for now.
Comment 1 Szymon Brandys CLA 2012-05-15 05:16:13 EDT
I'm not sure who should be looking at it.
Comment 2 Susan McCourt CLA 2012-05-15 11:09:13 EDT
I opened a general bug (bug 379567) about this issue.
This is a specific case. 
if the timeout hack is working for now, I would recommend that we look at this issue as a whole, using this case as a use case, but perhaps not in 0.5.
Comment 3 Susan McCourt CLA 2012-09-13 11:50:47 EDT
For 1.0 I'd like to have some kind of dom insertion event that our widgets fire.  Taking this bug because it's a good use case....using the event instead of a timeout.
Comment 4 Susan McCourt CLA 2013-01-17 11:54:58 EST
Libing is reworking compare widget to get rid of dojo and border container.  It may change the need for this.  At any rate we should recheck the situation when compare widget is dijit-free.
Comment 5 libing wang CLA 2013-01-18 10:10:32 EST
I will keep an eye on it before the un-dojo is done.
Comment 6 libing wang CLA 2013-06-14 10:13:46 EDT
I believe Gabriel did something removing the delay of the compare rendering. Not sure that is related to this bug.
Comment 7 Gabriel Luong CLA 2013-06-14 10:52:31 EDT
I noticed this problem since we would use the timeout to wait for the parent div to be added to the dom before rendering the compare widget. However, that isn't really needed. Since we already created the parent div (although not yet added to the dom), the render function failed because we passed in the parent div id, instead of the parent div object (<div id="parent">...</div>) and lib.node() would throw because it cannot find the parent in the dom given the node id. However, passing the dom element object directly will allow us to continue modifying the object.

You can view the changes I did to remove the delay in rendering the stage/unstage buttons and compare widget in http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=3dbb8cea6547859e9ff43d3118ad0f71e6bac86c

Sample of the change (taken from gitStatusExplorer.js):

Before:
- passing in the dom element id
> var diffActionWrapper = document.createElement("span"); //$NON-NLS-0$
> diffActionWrapper.id = "unstaged" + item.name + "DiffActionWrapper"; //$NON-NLS-0$
> ...
> div.appendChild(diffActionWrapper);
> window.setTimeout(function() {
>    that.commandService.destroy(diffActionWrapper.id);
>    that.commandService.renderCommands(
>    "DefaultActionWrapper", diffActionWrapper.id, item, that, "tool", null, navGridHolder); //$NON-NLS-1$ //$NON-NLS-0$
> }, 300);

After:
- passing in the dom element object
>    that.commandService.destroy(diffActionWrapper);
>    that.commandService.renderCommands(
>    "DefaultActionWrapper", diffActionWrapper, item, that, "tool", null, navGridHolder); //$NON-NLS-1$ //$NON-NLS-0$
Comment 8 Gabriel Luong CLA 2013-06-14 11:21:45 EDT
Also, refer to Bug 410530 - Remove delay in rendering of the compare widget and stage/unstage buttons in git status and git commit explorer
Comment 9 libing wang CLA 2013-06-14 14:28:23 EDT
fixed in Bug 410530.

*** This bug has been marked as a duplicate of bug 410530 ***