Deploying Lightning Components sometimes erases other files in bundle

Issue #309 resolved
Nathen Drees created an issue

If you have an existing lightning component and you edit just the .cmp file, when it is deployed to the server only the .cmp file is left. If you edit any other file, they all deploy as a bundle correctly.

Local files:

Screen Shot 2016-05-02 at 10.41.49 AM.png

After editing the .cmp file:

Screen Shot 2016-05-02 at 10.41.37 AM.png

After editing the helper, controller, or css file:

Screen Shot 2016-05-02 at 10.42.46 AM.png

Comments (32)

  1. Scott Wells repo owner

    Yikes! Thanks for letting me know. I thought I'd worked through all of the bundle deployment stuff, but obviously not. I should be able to turn around a fix very quickly for this.

  2. Scott Wells repo owner

    I'm having trouble reproducing this. I created a component with a renderer, a helper, a controller, and a style. None of these were on the server. I made a change to the .cmp file and all bundle contents deployed properly. Any other steps you might have been taking that could help with a reproduction?

  3. Nathen Drees reporter

    I'm not sure. I had this component created before you released this update, and was just using the retrieve metadata feature to get the latest files in to source control. Maybe this is only an issue for components that aren't created in IC?

  4. Scott Wells repo owner

    Hmmm...it shouldn't matter where/when they were created. The deployment code is agnostic of that. Obviously this happened to you, though. Does it still happen? In other words, if you save just the .cmp file, does it wipe out other contents? Or perhaps put another way, if you make a change to the controller or helper outside of IC and then make a change to the component inside IC, is just the component deployed or are all the bundle contents deployed? If you can get into a reproducible state I'll have you enable some debug logging so I can see what's going on. Thanks!

  5. Nathen Drees reporter

    Ya, i just tested again and this issue still happens, but only for components that were created before IC supported them. If i create a new one through IC and edit it, it seems to work fine.

    If I edit the .cmp file, then only that file is deployed, but if i edit any other file in the bundle the entire bundle is deployed correctly.

  6. Scott Wells repo owner

    Thanks for following up. It baffles me that there would be a difference between components created within IC vs. outside. Do those created outside have -meta.xml companion files? Just trying to figure out what might cause the difference.

  7. Nathen Drees reporter

    Hi Scott -

    Sorry for the delay, got side tracked with other things. Yes, all of the components have -meta.xml files. I just reproduced the issue on a component I created through IC, so it looks like this happens regardless of where the component is created.

  8. Scott Wells repo owner

    Thanks for following up, Nathen. Do you mind enabling some debug logging and sending me the log contents from the deployment? I think the following should be sufficient:

    #com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer
    

    Just in case you don't remember where to add that, it's under Help>Debug Log Settings. Oh, and I should have some additional really nice enhancements to the JavaScript/CSS editors under Community Edition coming tomorrow (or perhaps Thursday)!

  9. Nathen Drees reporter

    Debug log attached. Note there are issues around the JS intellisense not working correct, which also started today, but i don't think is related to this issue.

  10. Scott Wells repo owner

    Nathen, It doesn't look like you put a hash in front of the class enabled for debug logging:

    Set DEBUG for the following categories: com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer 
    

    That should read:

    Set DEBUG for the following categories: #com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer 
    

    Do you mind repeating the operation with the leading hash? That should give me good info. Also, I've fixed that repeating NPE in your log for the next build that will likely come out tomorrow morning.

  11. Scott Wells repo owner

    Thanks, Nathen. I'm pretty sure I see exactly what's happening, and it looks like a very simple fix. Let me reproduce the issue to confirm my suspicion and then I'll make the fix. Assuming that all goes well, I'll put this together with a few other fixes and get something out ASAP. Thanks again for providing the info!

  12. Scott Wells repo owner

    Hmmmm....it wasn't what I thought it would be, but I still think I have a solid lead on it. Have you by chance disabled IntelliJ's automatic refreshing of the file system when the window receives focus? It looks to me like perhaps the other bundle contents aren't "seen" by IntelliJ when I realize you're deploying a bundle, so the enumeration of the bundle directory returns an empty list. If you have disabled automatic refresh, does this start working for you if you re-enable it and/or perform an explicit synchronize (under the File menu) before performing the deployment operation?

    If it's not one of those, I'll need to add more logging to see where/when the other bundle contents are getting lost.

  13. Nathen Drees reporter

    Scott -

    I haven't disabled refresh. I can add files outside of IntelliJ and when I switch back to it, it correctly detects they're there and displays them in the project pane.

  14. Scott Wells repo owner

    Okay. I've reproduced what you're seeing, but only if I disable refresh-on-focus and manipulate files outside of IntelliJ. That would certainly help with the original thought that this was only happening with components created outside of the IDE (which obviously was not the case later).

    I'm going to need to add some debug logging around how I gather bundle contents when I first realize it's a bundle to see where things are getting lost. I'll add that in the next build and let you know how to gather additional diagnostic info.

  15. Scott Wells repo owner

    Nathen, tomorrow morning I'll release 1.7.1.5 with several bug fixes as well as more diagnostic logging in this area. You'll want to add the following classes for debug logging:

    #com.illuminatedcloud.intellij.builder.ForceComBuilder
    #com.illuminatedcloud.intellij.lightning.LightningBundleUtil
    

    and then run the operation again which fails to deploy the full contents. Hopefully that'll give me an idea of where this is failing to include the full bundle.

  16. Nathen Drees reporter

    Scott -

    Here's the latest logs. It looks like the core issue is that when I edit the .cmp file it doesn't do the check to see if it's part of a Lightning Bundle, and jsut deploys that file. When I edit any other part of the bundle, I can see it checking for the bundle and deploying everything.

  17. Scott Wells repo owner

    Thanks again, Nathen. Let me take a look and see what I can discern. Might need to add a little more info if I still can't pinpoint it, but I feel like we're definitely closing in on it!

    Looks like I addressed that NPE. Out of curiosity, are you finding the simple JavaScript/CSS support for Lightning/Visualforce useful?

  18. Nathen Drees reporter

    Scott -

    I haven't had a chance to really dig in to the JS stuff. I did notice the syntax highlighting, which is nice, and I think I saw intellisense starting to pop up but most of my development on the component was already done. I'll have to play with that more in the future.

    On the CSS side, I'm not seeing anything change, it's still just treating CSS files like plain text files:

    Screen Shot 2016-05-19 at 10.26.47 AM.png

  19. Scott Wells repo owner

    Their built-in "simple" highlighting for CSS in Community Edition is MUCH more basic than for JavaScript. If you add a number, it'll be blue...things like that, but there's no keyword highlighting or anything. I have a shelved changelist where I do some keyword highlighting, but because there's no real AST for the CSS body, I can't easily differentiate between keywords in comments and strings and real keywords. It was overly noisy, so I didn't include it (yet). However, it should support completion for CSS keywords, auto-indentation (but not full formatter support), brace matching, etc.

    My goal here was to provide a decent experience under Community Edition for those that only want to buy Illuminated Cloud and not Ultimate Edition, then let JetBrains provide full support for those that want to pony up for it.

  20. Scott Wells repo owner

    No progress on this issue yet, but I did just push up a new build that includes significantly better syntax highlighting and code completion for CSS. Figured I'd mention it since it was a point of our prior conversation.

  21. Scott Wells repo owner

    Nathen, I started to look at this in more detail and noticed that the debug logging isn't complete. It looks like you added ForceComBuilder and LightningBundleUtil but not ForceComMetadataApiDeployer. Looking at my comments above, I wasn't clear that I really need the output of all three. Let's go ahead and include ForceComToolingApiDeployer as well.

    Do you mind doing this one more time with all three of these included? It should look like this before you run the operation:

    #com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer
    #com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer
    #com.illuminatedcloud.intellij.builder.ForceComBuilder
    #com.illuminatedcloud.intellij.lightning.LightningBundleUtil
    

    Hopefully that will give me what I need to determine what's going on once and for all.

  22. Scott Wells repo owner

    Thanks! I think I see what's going on finally with this log. Let me confirm and I'll follow up with details, but I feel pretty good that this is cornered now.

  23. Scott Wells repo owner

    Okay, so here's what I'm seeing/thinking...basically for some reason it's thinking that it can/should deploy the .cmp file via the Tooling API:

    2016-05-25 09:19:55,285 [  55510]  DEBUG - der.ForceComToolingApiDeployer - Using the tooling API to deploy the following files: { InventoryTabs.cmp }. 
    

    The only reason it would make that decision is if for some reason that file was associated with either the Apex or Visualforce file type. Did you by chance associate the Lightning markup file extensions with the Visualforce file type before I added first-class support for Lightning? That would definitely explain what's happening. You can confirm this by going into Settings>Editor>File Types and verifying/adding an association for *.cmp with Lightning Component. My guess is that it's going to prompt you to reassign it from Visualforce Page. You'll want to do this for *.auradoc, *.design, *.evt, and *.intf as well. You do not need to do this for *.app, though.

    Let me know if this hunch is correct or not and, if it is, if it corrects the behavior for you. If it doesn't then I'll add some additional debug logging that will tell me exactly why it's deciding that your components can be deployed via the Tooling API.

  24. Nathen Drees reporter

    Scott --

    I took a look and it looks like my .cmp files were associated with VF instead of with lightning component. I'm not sure how that happened, as I don't remember ever creating that association. I switched it back over to Lightning Component and everything seems to be working correctly now. Thanks for the help!

  25. Log in to comment