two snippets with the same name

Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
edited July 1, 2019 in Questions
Suppose I have two snippets with the same name.

(please hold all the WHY WOULD YOU EVER DO THAT!?! comments.. ย if the answer is favorable this will save a lot of time)

One snippet is on page, another is in a static resource.

Which will run first?

Does it depend on the order that they are entered in the builder?

Comments

  • Karen WaldschmittKaren Waldschmitt ๐Ÿ› ๏ธ ๏ปฟ
    edited March 2, 2017
    Matt~

    In line snippet wins in a race against static resources.

    Thanks!
    Karen
  • Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited February 10, 2017
    Sweet. Thanks!
  • Barry SchnellBarry Schnell ๐Ÿ’Ž๐Ÿ’Ž
    edited July 1, 2019
    Matt -

    FYI on this issue that I posted about a month agoย https://community.skuid.com/skuid/topics/resources-not-emitted-in-order-specified?rfm=1&topic_su.... ย 

    I'm still waiting on a reply but as I mention in the issue, the order specified in the builder SHOULD matter - but instead it behaves like "it depends" currently and its not documented. ย As Karen mentions, I believe inline snippets will always get loaded after static resources with the current functionality. ย That said, being able to specify order (in order to reliably predict) the exact order things will loadย is critical to proper functioning - especially when you might need to do something in an inline snippet that a static resource then relies on (which wouldn't even be possible today).

    Short story - Keep an eye out on the other thread just in case anything changes (which it should IMHO:)).
  • Barry SchnellBarry Schnell ๐Ÿ’Ž๐Ÿ’Ž
    edited November 18, 2016
    Oh yeah, forgot to ask -ย WHY WOULD YOU EVER DO THAT? ;)
  • Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited July 1, 2019
    Thanks, Barry. I'll keep an eye out. I'm deploying an app to multiple customers who may need to customize some of the javascript functionality, and I'm trying to make it as modular as possible. In the current scenario, they can write their own inline snippet to override the stock functionality that I deploy in a static resource by using the same snippet name. Then if I deploy an update to the stock resource it won't override their customization.
  • edited December 14, 2016
    hahahahahahahhahahaa
  • edited December 14, 2016
    That's a good reason (better than I expected :p)
  • Barry SchnellBarry Schnell ๐Ÿ’Ž๐Ÿ’Ž
    edited November 18, 2016
    Hey Matt - I was just kidding with that question :) ย I could see reasons you would want to do this (e.g. a "derived" customization of base functionality). ย Fortunately, even if the order resources are loaded changes (per the other post I linked to), your approach will still work as long as the customers snippet comes after the SR that you provided for them. ย Pretty cool way to provide flexibility to your customers!
  • Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited February 10, 2017
    Ok, followup to this:

    Suppose I have two snippets with the same name. One is in the ModuleJS static resource that skuid pulls in to all pages in that module. The other is in a static resource that's added declaratively to the page.

    Which wins?
  • Karen WaldschmittKaren Waldschmitt ๐Ÿ› ๏ธ ๏ปฟ
    edited March 2, 2017
    Matt~

    Sorry for the delayed response. The static resource added declaratively to the page wins.ย 

    Karen
  • Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited February 10, 2017
    Thanks, Karen.
  • Matt SonesMatt Sones ๐Ÿ’Ž๐Ÿ’Ž๐Ÿ’Ž
    edited February 10, 2017
    Ok, another question in this vein...

    Two snippets with the same name, in different static resources added declaritively to the page. If I am correctly understandingย Barry's post here, the static resources are currently being loaded in the order that they are entered in the builder?

    But what does that mean in this use case? Does the snippet in the first static resource win, or in the second?

    Thanks!
  • Karen WaldschmittKaren Waldschmitt ๐Ÿ› ๏ธ ๏ปฟ
    edited March 2, 2017
    Matt~

    So what ever is evaluated last wins when it comes to name conflicts.

    Thanks!
    Karen
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!