How do you debug?

I’m a newer user to the SB space and am still getting my feet wet when it comes to breaking down issues and frequently am back in the documentation, this forum, and the Github issues when it comes to problems.

SB isn’t intended and never will be a full-fledge IDE of course, but since there are programmatic elements there are times when getting a deeper insight into workings would help to debug a problem.

For template language/queries, I’ve seen approaches breaking down the issue such as the following:

  1. access first element by query (as markdown table)
{{at({page}, 0)}}
  1. access first element attribute
{{at({page}, 0).name}}

There are sometimes errors or bugs not explicitly detailed in current error logs to the user or server and I wanted to see if there are proper debugging modes to walk through all the actions taking place.

My most current issue (the main instigator of this post :slight_smile:), is that after an unknown change I can no longer use Navigate: Page Pick/Ctrl+k. After choosing that option I can’t run any other commands (from the Ctrl+/ menu or from buttons/hotkeys such as System: reload). I can “fix” the freeze by refreshing the current page.

Since there are no error outputs to either the user-end or the server, my current approach is to create a duplicate space and add my content into it until something breaks… I’m wondering if there is a better way to do this and and interested in hearing how others debug!

Somewhat related recent post: how to debug space scripts

1 Like

Adding some flavor to this one since months later I still am having this issue consistently and can’t figure out the root cause.

When reviewing the console when using the Page Picker, it was seen that a TypeError is occurring.

Going into the console’s stack trace, it’s seen that an array of hashtags is created from pageMeta.tags and defined as a description as a joined string with spaces between them, unless there are none in which case a blank string is assigned (i.e., it adds hashtags from pageMeta.tags to a description variable if pageMeta.tags exists).
image

I’ve started digging deeper, but everything in JS libraries are minified and very difficult to understand outside of just seeing what variables are holding in the debugger. I’m not sure if there’s a way to de-“minify” them to understand processes better.

My best guess is that a page I’ve created at some point is inappropriately tagged such that it breaks the navigator. My next step will be to start a fresh silverbullet server and populate it with templates (and other pages) one at a time until I can identify the source of grief.