Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

snippets are no longer available via localStorage

Open
#23 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
devtools

Research direction

Start by locating the snippet persistence code that currently uses localStorage, then read the InspectorFrontendHost.getPreferences and setPreference entry points described in the issue. Done means snippets remain available after the Chrome storage change and existing snippet behavior continues to work.

Written by the indexing model from the issue text.

Description

enhancement quality

We made snippets (among other settings) available from incognito. I think this change landed in Chrome stable around 46/47 or so.

As a result, they are no longer available in localStorage. Here's the new technique. These are run from a devtools-on-devtools window.

getting snippets
InspectorFrontendHost.getPreferences(_ => console.log(JSON.parse(_.scriptSnippets)))
setting snippets
InspectorFrontendHost.setPreference("scriptSnippets", JSON.stringify(yourSnippets))

FWIW, InspectorFrontendHost.getPreferences will return everything that has migrated to the incognito-available settings (most things), while a few items (like breakpoints) remain in the devtools' localStorage

Tagging a few other issues that use this technique:

Dominant language
JavaScript
Stars
1.8k
Forks
196
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bahmutov/code-snippets

All issues in bahmutov/code-snippets

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.