10

I am crossposting this here as it has very low visibility on the meta site that I posted it on originally.

Front Page Not Updating

I am running into an issue where the front page of the Board & Card Games Stack Exchange site is not updating to reflect recent activity. Other tabs that I have open to different sites seem to be updating without any issues, but this is not the case for Board & Card Games. In order to see new activity I need to manually refresh the site and this does not appear to be an issue for other users.

Has anyone seen this on other sites and know what I might be able to do in order to fix it?

This is on Windows 10 with the current version of (Chromium-based) Vivaldi (though this has been happening for many versions) and I don't have any SE-related plugins. And it should be noted that all sites but Board Games are updating as expected.

As a note, I first experienced this issue early last year and asked about it on March 9th 2022.

This is likley the error showing itself in the console as this pops up after new content is on the pages front page.

Console error

Update:

I have removed all watched tags (had no ignored) as this was the only site with watched tags. I forced a hard reload of the page and I am still getting this same error message in the console.

Update 2:

It appears the Board & Card Game Meta site is not updating like I thought it was.

14
  • 1
    How bizarre. I'm seeing activity as recent as an hour ago. I do not have an account there. See this search for recent posts.
    – Laurel
    Jan 23, 2023 at 20:09
  • 3
    It still seems to be working here on MSE, but it's higher volume. Without any activity on B&CG it's going to be difficult to see if it's working for me but I have the page open and I'll check it periodically.
    – Catija
    Jan 23, 2023 at 21:09
  • Updates rely on the websocket. In your developer console (I assume Vivaldi has one as well) you should find the 4 outgoing messages: i.sstatic.net/lEOSP.png. The 147-home-active should subscribe to updates, so if you have that message then leave it running for a while to see if anything comes in. If you have errors there or none of those messages, then its best to update the question to include those errors. Every 5 minutes or so you should receive a "hb" (heartbeat) "pong" message that is responded to with a "pong"
    – rene
    Jan 24, 2023 at 6:56
  • I captured an update as well to document what you can expect: i.sstatic.net/KGxKT.png
    – rene
    Jan 24, 2023 at 7:31
  • @rene I understand that but why would that be working for all the other sites including that sites meta? As for the developer console I have no clue where I am supposed to be looking for that information.
    – Joe W
    Jan 24, 2023 at 13:16
  • @JoeW I don't know, it works for me and I tested on Board Games se. The only difference so far is that I'm using Chrome and I'm not on your network (at least that is my assumption).
    – rene
    Jan 24, 2023 at 13:21
  • I checked in chat with another user that uses Vivaldi and for them everything seems to work as designed. Maybe a (local) network issue and/or virus scanner is playing tricks.
    – rene
    Jan 24, 2023 at 14:49
  • @rene I understand that and as I have been saying it is working perfectly for me on every other stack exchange network that I am using. I am trying to determine what is different between the Board & Card Games site and the rest of them that is breaking it for me.
    – Joe W
    Jan 24, 2023 at 15:50
  • Do you have any watched tags on Board Games? And none on the other sites where you don't face this issue?
    – rene
    Jan 25, 2023 at 13:52
  • 1
    @rene Yes, that is the case and I have removed all my watched tags (had no ignored tags) to see if that will change things at all. Once I figure out if that fixes it or not I will update the question or post an answer as needed.
    – Joe W
    Jan 25, 2023 at 13:56
  • @rene Quick update that removing the watched tags did not appear to fix it.
    – Joe W
    Jan 25, 2023 at 19:19
  • That is unfortunate. I was trying to map the stack trace back to the dev version of full.js: dev.sstatic.net/Js/full.en.js but I'm not sure that everything lines up. Maybe it is an out-of-order async load of a script. But then it is peculiar that only you have the problem, all the time and only on that specific site. I'm sorry I can't be of more help. This needs a dev to investigate further.
    – rene
    Jan 25, 2023 at 20:32
  • @rene I appreciate the help and hopefully the info I added as a result can help the devs track this down.
    – Joe W
    Jan 25, 2023 at 21:23
  • This looks like it might be related to my question on MSO: Questions with ignored tags are hidden on the homepage even if the "gray out" option is selected
    – 41686d6564
    Jan 26, 2023 at 22:39

1 Answer 1

12

This is a real bug in SE's code

This is, in fact, a bug in SE's code. The function StackExchange.tagPreferences.isIgnored(tags) is called as StackExchange.tagPreferences.isIgnored(post.tags) within activeQuestionsUpdate(), which is added as an event consumer for SE's WebSocket listener. There are two issues with that.

  1. A tags property is not defined in any of the *-home-active WebSocket messages which I checked. It's clear that it's expected to be defined, so the fact that it's missing is, probably,the real issue/bug. So, post.tags is undefined when StackExchange.tagPreferences.isIgnored(post.tags) is called.
  2. Within the StackExchange.tagPreferences.isIgnored(tags) function, the tags argument is never validated and is assumed to be an Array. So, when tags.some() is executed in the return statement an exception is generated, the error is displayed in the browser console, and no "X question(s) with new activity" banner is displayed.

Duplicating

In order to duplicate this problem, under "Ignored tags" you have to select the "Hide questions in your ignored tags" radio button. If the "Gray out questions in your ignored tags" radio button is selected, then this error won't occur. You don't need to actually define any tags to ignore. Merely selecting the "hide" radio button is sufficient.

Workaround

Select within the "Ignored tags" area, select the "Gray out questions in your ignored tags" radio button.

Problem code

The real problem code is probably within SE's WebSocket server, as the proximate cause of this issue is that the question's tags are not being sent along with the notification of activity on the question. Without those tags being included, the filtering in JavaScript to not show notifications for questions which would be hidden by the user's ignored tags can't be done.

JavaScript code which makes this issue "no activity is shown", rather than an issue of "I'm being notified of activity I've told the system to hide"

The following are from SE's full.en.js, which can be downloaded from here.

The following code is mapped to StackExchange.tagPreferences.isIgnored

const isIgnored = function (tags) {
    if (!hideIgnored()) {
        return false;
    }
    var $ignoredTags = find('.js-ignored-tag-list .post-tag');
    var ignoredSelector = getTagsSelector($ignoredTags, true);
    // translate return value (jquery specific selectors) of getSingleTagSelector to a regex we can test against a string
    var ignoredTagExpressions = ignoredSelector.split(/,(?!\s)/).map((s) => {
        const selectorStartsWith = /^\[class\*=' t-(.+?)'\]$/;
        const selectorRegex = /^:regex\(class, t-(.+?)\)$/;
        let regexStr;
        if (selectorStartsWith.test(s)) {
            // [class*=' t-tag'] > tag.*
            regexStr = s.match(selectorStartsWith)[1] + '.*';
        }
        else if (selectorRegex.test(s)) {
            // :regex(class, t-t.*name) > t.*name
            regexStr = s.match(selectorRegex)[1];
        }
        else {
            // .t-tagname > tagname
            regexStr = s.replace(/^\.t-/, '');
        }
        // put the className reserved characters back, but escaped so they aren't mistaken for regex reserved characters
        regexStr = regexStr.replace('ñ', '#').replace('ç', String.raw `\+`).replace('û', String.raw `\.`);
        return new RegExp(regexStr);
    });
    return ignoredTagExpressions.length > 0 && tags.some((t) => ignoredTagExpressions.some((s) => s.test(t)));
};

The following code is added as an event consumer and passed the data from the WebSocket message .data, which has been run through JSON.parse(), as the post argument:

function activeQuestionsUpdate(post, channel) {
    // don't update if there are matching ignored tags
    if (StackExchange.options.user.accountId != null && StackExchange.tagPreferences.isIgnored(post.tags))
        return;

    // The body will be fetched when we click to actually show them
    activeToShow[post.id] = { id: post.id, fetch: true, index: new Date().getTime(), siteid: post.siteid, channel: channel };

    $('.js-new-post-activity').remove();

    $('#question-mini-list, #questions')
        .prepend(activeTab);

    // tag-sponsorship fix
    if ($('.tag-sponsorship').length > 0) {
        $('#question-mini-list, #questions').css('margin-top', '0px');
    }
}
7
  • That makes a lot of sense and I have made that change on the site. Once I confirm that the work around works I will accept this answer!
    – Joe W
    Jan 26, 2023 at 19:20
  • Is there a user script that can be created to fix the problem in the meantime? Jan 26, 2023 at 19:32
  • 6
    Wow, awesome research here. I marked this as [status-review] so we can prioritize a fix and this will be really helpful.
    – Kyle Pollard StaffMod
    Jan 26, 2023 at 19:42
  • 1
    I was able to confirm that this was the problem as expected. Also I will be referencing this answer to post an answer on my original question on the Board & Card Games Meta site so I can wrap that question up. Thanks again for that amazing research.
    – Joe W
    Jan 26, 2023 at 20:38
  • @KylePollard This might be related to Questions with ignored tags are hidden on the homepage even if the "gray out" option is selected. Could you please have a look?
    – 41686d6564
    Jan 26, 2023 at 22:40
  • @SonictheAnonymousHedgehog I'm not aware of a userscript which resolves the issue, but it would be possible to create one. Probably the cleanest way to do it would be to asynchronously intercept the WebSocket connection, wait for messages on the affected channel subscriptions, fetch the tags for each question that's reported, insert those tags into the WebSocket message, and then pass the adjusted WebSocket message to the various consumers. Given that it's a relatively low-impact issue with a work-around, it's not clear to be that it's worth the effort.
    – Makyen
    Jan 27, 2023 at 0:02
  • particularly given that SE might fix this in the near term, maybe. If you're willing to get activity notifications for new/active questions which have your ignored tags, then it would be possible to use CSS to just hide them instead of just gray them out, which would be a bit easier.
    – Makyen
    Jan 27, 2023 at 0:02

You must log in to answer this question.

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