54

I'm unable to get rid of a filter that goes by the name of "My Filter". This is the default name you get when you click on New Filter. There's a clickable "Delete this filter", which leads to a confirmation question on whether you really want to delete it. Clicking "Yes" leads you back to the "New Filter" Screen, with a new filter named "My Filter".

I don't know whether this is the same filter I was just trying to get rid of, or whether it got rid of the old one, and now is making a new one with the same old name. Either way, I'm stuck.

10
  • 8
    I can reproduce this, both with "My Filter" and "My Filter (2)". I also tried deleting another filter (one that was for a now-burninated tag) which deleted it but created "My Filter (3)". It is clearly deleting and creating a new filter, since the number in the URL changes.
    – Laurel
    Commented Mar 3, 2019 at 21:14
  • 3
    Same for me - deleting a filter does not work. I now have "My Filter" and "My Filter (2)".
    – Mark
    Commented Apr 12, 2019 at 4:01
  • 2
    It's even older, I originally reported it in October 2018.
    – Glorfindel Mod
    Commented May 17, 2019 at 18:59
  • Is there a workaround where you can remove ALL of your filters, including the good ones, and start over with a clean slate? Commented Jul 2, 2019 at 12:48
  • Has there been any progress on this? Commented Mar 1, 2021 at 16:35
  • 1
    @WalterMitty nope: i.sstatic.net/kAADx.png but I put a bounty on it to get some more eyes on it. Hopefully one eye belongs to an SE dev or a CM ...
    – rene
    Commented Jun 6, 2021 at 19:13
  • 3
    @rene The current roadmap is more along the lines of remove filters from stackexchange.com entirely and put them somewhere else. I'm not familiar enough to know where that progress is. But this bug would likely be fixed in the process of completing that work.
    – animuson StaffMod
    Commented Jun 7, 2021 at 5:45
  • Still a bug? I'm afraid to click delete on filter not to have yet anohter "My Filter".... :-)
    – Gas
    Commented Apr 26, 2023 at 14:46
  • 3
    @Gas yes still a bug, and might still be a bug for long time, SE fix only handful (i.e. can count on one hand's fingers) of bugs due to, well, off topic here. Commented Aug 28, 2023 at 13:03
  • @animuson any updates on what you said about removing filters from se.com? Commented Mar 6 at 15:35

4 Answers 4

30
+300

Adding details in hopes of getting developer attention.

Reproducing the issue from a clean state.

I believe this may be how to reproduce this issue. I can't verify, because I'm already in the broken state.

  1. Start with at least 1 existing, valid filter (with tags and everything).
  2. Click New Filter.
  3. Instead of finishing that filter, click on the existing, valid filter.
  4. Delete the existing, valid filter.
  5. There should be a My Filter in the reloaded page, even though you never finished creating it. Try to delete My Filter now.
  6. This might be what spawns My Filter (2). (Not as sure about this part.)

Reproducing the issue from the broken state.

However one gets to the broken state, one can easily keep reproducing more and more My Filters simply by clicking New Filter while viewing an existing, valid filter.

enter image description here

Does finishing the creation of those filters allow them to be deleted? (No.)

These are screenshots from before I created a bunch of My Filters. This is what you see when looking at My Filter.

enter image description here

If we finish creating the filter, can we delete it? Let's make it into a filter...

enter image description here

Clicking "Save Changes"...

enter image description here

Clicking "edit" and "delete this filter"...

enter image description here

Huh? The page reloads and My Filter is back.

enter image description here

I've also tried finishing the creation of all the My Filters, in case having any unfinished filter was causing the issue. No luck.

1
  • Thanks. Sounds like it should he easy to rix. Commented Mar 25 at 21:23
7

The issue is because deletion redirects to the new filter page. Which thus creates a new filter. See more details in my bug which happened to be a duplicate: Deleting a network-wide filter creates a new filter in its place


Workarounds

Manual

To get rid of filters once and for all, you can hit the deletion URL with the filter ID https://stackexchange.com/filters/delete/454503 and not follow the redirection. The simplest way is:

  1. Go to https://stackexchange.com/filters/

  2. Find the ID of the filter you want deleted. This would be in the URL:

    After a filter is selected, the URL will show its ID and name at the end.

  3. Open the console and execute the following making sure the ID is replaced

    fetch("https://stackexchange.com/filters/delete/<filter_id_goes here>", { redirect: "manual" }) 
    

    For example if you want to delete filter with ID 454506 the correct URL would be https://stackexchange.com/filters/delete/454506

  4. IMPORTANT! Then navigate to a different filter. If you simply refresh the page, you get the same thing again and a new filter will be created.

Bookmarklet

The steps above can be executed by a bookmarklet. Select a custom filter (it will not run for the default two on top) and run it. This will take the filter ID, delete the filter then move you to the top most filter to avoid creating a new one

Code for bookmarklet

javascript:(function(){const%20currentFilter=document.querySelector(%22%23sideBar%20.filters%20ul:nth-of-type(2)%20li.current%20.filter-name%20a%22);if(!currentFilter)return;const%20pathSegments=currentFilter.pathname.split(%22/%22),filterId=pathSegments[pathSegments.length-2],firstFilter=document.querySelector(%22%23sideBar%20.filters%20ul:nth-of-type(1)%20li:nth-child(1)%20.filter-name%20a%22);fetch(`https://stackexchange.com/filters/delete/${filterId}`,{redirect:%22manual%22}).then(()=%3Elocation.href=firstFilter.href)})();

Expanded code

(function() {
    const currentFilter = document.querySelector("#sideBar .filters ul:nth-of-type(2) li.current .filter-name a");
    if (!currentFilter)
        return;
    
    const pathSegments = currentFilter.pathname.split("/");
    const filterId = pathSegments[pathSegments.length - 2];
    
    const firstFilter = document.querySelector("#sideBar .filters ul:nth-of-type(1) li:nth-child(1) .filter-name a");
    
    fetch(`https://stackexchange.com/filters/delete/${filterId}`, { redirect: "manual" })
        .then(() => location.href = firstFilter.href);
})();

Userscript

I published a userscript that fixes the behaviour of filter deletion on StackApps visit the page for more details.

For convenience, the short version is here:

Direct install (GitHub)

See the code on GitHub

(For instructions how to install userscripts: see the tag wiki here)

2
  • 3
    The weird thing is that a GET request is being used to both create and delete the filters... Let me go and create an img tag to create new filters for anyone viewing this post :P (just joking) Commented Mar 25 at 12:39
  • 4
    @AbdulAzizBarkat actually that's a pretty serious XSRF exploit, SE must handle this. Commented Mar 25 at 12:48
4
+100

As a manual workaround to delete a filter without creating a new one one can do it by running some code using the developer tools of your browser:

fetch("https://stackexchange.com/filters/delete/FILTERS_ID_HERE", { redirect: "manual"})

Replace the "FILTERS_ID_HERE" with the id of the filter you want to delete (You can get this from the URL of your filter). This basically hits the URL used to delete the filter but does not follow the redirect that ends up creating a new filter.

1
  • 2
    Nice workaround, thanks. Someone might even make it into a userscript, and add extra "delete" button, that invokes it for each filter. Commented Mar 25 at 11:58
2

I made a mistake and clicked the "New Filter" button too many times so I found some temporary solution to "delete" not needed "New Filter" from my site: it is the uBlock Origin extension for my browser.

I used uBO's filters to hide the "New Filter" position in the menu and the "New Filter" button to not click it by accident. My current and working uBO filters are:

stackexchange.com##li:nth-of-type(5)
stackexchange.com##[href="/filters/new"]

The first line hides "New Filter" (it's 5th one in my the second line hides the "New Filter" button.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .