harper icon indicating copy to clipboard operation
harper copied to clipboard

Won't remember my Rules on Firefox

Open katielilyluna-blip opened this issue 1 year ago • 5 comments

Describe the bug Every time I change a rule from "Default" and then close the tab, it doesn't save. If I open my settings again the rule will be reverted back from "On" or "Off" to "Default." It seems to remember when I change my settings though.

To Reproduce Steps to reproduce the behavior:

  1. Open settings
  2. Change any rule (such as ACoupleMore) to "On" or "Off"
  3. Close tab
  4. Open settings again, Rule is still set to "Default."

Expected behavior When change a Rule from default the program remembers it.

Platform Firefox Extension

katielilyluna-blip avatar Aug 28 '25 08:08 katielilyluna-blip

I can confirm this is happening with 0.61.0 and Firefox 142.0.1.

glocalglocal avatar Sep 08 '25 14:09 glocalglocal

I've replicated the problem. It doesn't indeed only happen on Firefox. Chrome does not have this issue. I'm looking into it now.

elijah-potter avatar Sep 08 '25 16:09 elijah-potter

Hi, new user, also having this problem. Choices don't save after I close the tab, and all changes will revert back to default if I turn the Harper extension off in any tab (even if I haven't closed the settings tab). I turn it off while writing so it doesn't distract me, I need to be able to enable and disable it without losing all my settings.

2023 MacBook Pro, Tahoe 26.3 Firefox 147.0.3 (aarch64) Harper v1.7.0

the-spookiest avatar Feb 14 '26 02:02 the-spookiest

Hello, I am experiencing this issue in hitting this on both Chrome and Firefox. The issue seems consistent — toggle any rule away from default, come back to the settings page, and it's reverted. Doesn't matter if you close and reopen or just navigate away and back.

I tried watching whether storage actually changes when you toggle a rule

  • I ran chrome.storage.onChanged.addListener() in the DevTools console on the settings page before toggling a rule
  • No storage events fired at all. The UI accepts the toggle visually but never calls storage.set().
  • I suspect the bug is specifically that the settings component has no write path for rule changes, not a race condition or bad value being written?

I’ve verified that the storage itself is fully functional

  • When I manually push a change to it, the rules persist and apply correctly across restarts.

  • Since the UI has no active "write path," I just used the following console patch workaround to force updates directly into the extension's storage:

  • Open the Developer Tools console for the extension.

  • Run the snippet below, replacing KEY_NAME with the desired rule and false/true for the state.

  • Refresh the extension/page to trigger a re-read of the configuration.

For Chrome:

// Define the keys and the new states (true/false) here
const settingsOverrides = {
    "KEY_NAME_1": false,
    "KEY_NAME_2": true
};

chrome.storage.local.get("lintConfig", (result) => {
    let config = JSON.parse(result.lintConfig);
    Object.assign(config, settingsOverrides);
    chrome.storage.local.set({ "lintConfig": JSON.stringify(config) }, () => {
        console.log("Config updated:", config);
    });
});

For Firefox:

// Define the keys and the new states (true/false) here
const settingsOverrides = {
    "KEY_NAME_1": false,
    "KEY_NAME_2": true
};

browser.storage.local.get("lintConfig").then((result) => {
    let config = JSON.parse(result.lintConfig);
    Object.assign(config, settingsOverrides);
    browser.storage.local.set({ "lintConfig": JSON.stringify(config) }).then(() => {
        console.log("Config updated:", config);
    });
});

ElitheDumbGuy avatar Mar 24 '26 23:03 ElitheDumbGuy

I see you've been actively working on the chrome extension. I opened #3028 with a fix for this (on:change to onchange for the Svelte 5 migration), but if you have a different approach in mind or are planning to address it as part of your current work, happy to close the PR.

queelius avatar Mar 25 '26 14:03 queelius