Shaun Hevey
macOS Shortcuts editor performance issue
April 13, 2022
By Shaun Hevey

While developing a Shortcut in the new Shortcuts application for macOS, I ran into a bug that made editing the Shortcut almost impossible. So this post will quickly explain the issue and how suggestion on how I worked around it.

I am currently developing a Shortcut that will generate unique dynamic wallpapers for the device it is run on. It uses the JavaScript library named d3.js, and each design is an individual script. To store these scripts in the Shortcut so that they could be used, I created a dictionary, and each entry of the dictionary is a script.

The problem

The problem that I encountered after adding more than a couple of scripts is that editor, when you try to scroll, just freezes and becomes challenging to navigate. As you can see below, the Shortcuts editor on macOS wants to display the whole string value on the screen, whereas the iOS Shortcuts editor does not.

Shortcuts editor on macOS showing dictionary value

Shortcuts editor on iOS showing dictionary value

Workaround

To get around this issue, I created a new Shortcut on my iOS device that contained the dictionary filled with my d3 scripts. I then saved this dictionary into Data Jar. This allowed me to open Data Jar and copy the dictionary out as JSON. You can do this by right-clicking on the entry you just stored in Data Har and selecting the copy value option.

Data Jar windows showing my entry

Then once you have your JSON, you can paste that into your Shortcut in a text action and pass that text action to a Get Dictionary from ... action. This allows you to use the new dictionary the same as your old dictionary but without the performance hit in the editor.

Shortcuts using JSON dictionary action