Lightning Dash DocSet

Salesforce Lightning Dash Docset

I’m a fan of Dash for developer docs. It’s such a simple but smart idea to have all developer docs in one place. There isn’t yet a set of Dash Doc’s for Lightning… until now!

You’ll get the built-in Components, Interfaces, Events and Guide’s from the official Lightning docs.

If you have Dash installed then go to the Preferences, Downloads and choose User Contributed on the left side. Then simply search for Lightning and you’ll see the new Dash Docset there:

Installing Lightning Docset in Dash
Installing Lightning Docset in Dash

Enjoy and feel free to leave any feedback, bug reports, suggestions over on Github – https://github.com/mattgoldspink/docset-sfdc/issues

How NOT to add Google Maps to a Lightning Component!

This post about how you can create a Google Maps like Map component inside a Lightning component but without using Google Maps.

Wait You Said Google Maps in Lightning?

It would be awesome if you could embed Google Maps in a Lightning component and there are lots of posts that show how to do it, but if you look at them you’ll see they all use an iframe to embed it. The reason they need to use an iframe is because the Google Maps JS api has to be used from their servers. There’s no way in Lightning to use a JS library like that.

Now you maybe thinking… “well why not download it and upload it as a Static Resource?”. You can, but it’s not so simple because of the way Google dynamically generates/downloads the files.

What options are there then?

Well thankfully Google Maps isn’t the ONLY map solution available. Instead you can use a library called Leaflet.js.

Leaflet
Leaflet

Continue reading “How NOT to add Google Maps to a Lightning Component!”

Aw, Snap!

2.4Mb of pure Lightning JavaScript! Took over a minute to load AND when decompressed is over 20Mb! That’s a hell of a lot of JS!!

When you turn on debug mode in Lightning

Tried to open it up to see what wonders are inside of it and BAM!

Aw, Snap!
Aw, Snap!

Gotcha! Components in Shared regions don’t receive the recordId

This is for Shared Regions (like header, navbar, footer) in the Community app builder:

Community Builder Shared Regions
Community Builder Shared Regions

Today I learnt that if your component implements force:hasRecordId then it won’t get a record ID, even if you’re on an Account page for example.

Secondly – these shared regions are not re-rendered during navigation – which is obviously great for performance reasons 🙂

Why would a component in the shared areas want the recordId?

My use case for this is pretty simple- my Navigation Bar has some shortcuts to specific Products, so if the user ends up on the Product page (either by clicking directly or from a Search), then I want my nav bar to highlight that we’re now looking at that Product!

So, how can we workaround this limitation and have a component in the shared region get the recordId?

Continue reading “Gotcha! Components in Shared regions don’t receive the recordId”

The “OTHER” JavaScript Framework

As a web developer you’ll have heard the buzz of Angular (1, 2 and 4), React, Vue.js and others. But there’s another JavaScript framework that’s revolutionizing a platform for thousands of developers in a whole new way…

Lightning

Now I know that Salesforce often has a bad reputation among developers outside of its eco-system- Just check out the Stack Overflow 2017 for Most Dreaded Tech!

Most Dreaded Tech - Stack Overflow 2017 Developer Survey

I was voting that way too a few years ago! However I hadn’t really dived into Salesforce to appreciate the complexity and problems they’re solving.

So please stick with me for this, even if you’re not interested or a fan of Salesforce! There’s a lot that can be taken from what Lightning is doing.

Continue reading “The “OTHER” JavaScript Framework”