Topsheet error on homepage

To reproduce:

  1. Go to SuttaCentral.net
  2. Ctrl + Shiftl + R
  3. Click the three dot menu icon or search icon
  4. nothing happens. Search does not open, menu does not open

In the console we get 2 errors

Uncaught TypeError: e.hideTopSheets is not a function
    #N https://suttacentral.net/main.js:3183
    #M https://suttacentral.net/main.js:3183
    handleEvent https://suttacentral.net/main.js:3076
    c https://suttacentral.net/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js:1
    addEventListener https://suttacentral.net/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js:1
    _$AI https://suttacentral.net/main.js:3076
    p https://suttacentral.net/main.js:3076
    $ https://suttacentral.net/main.js:3076
    _$AI https://suttacentral.net/main.js:3076
    F https://suttacentral.net/main.js:3076
    update https://suttacentral.net/main.js:2849
    performUpdate https://suttacentral.net/main.js:46
    scheduleUpdate https://suttacentral.net/main.js:46
    _$EP https://suttacentral.net/main.js:46
    requestUpdate https://suttacentral.net/main.js:46
    set https://suttacentral.net/main.js:46
    __siteLanguageChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3183
    connectedCallback https://suttacentral.net/main.js:3996
    O https://suttacentral.net/main.js:3076
    T https://suttacentral.net/main.js:3076
    $ https://suttacentral.net/main.js:3076
    _$AI https://suttacentral.net/main.js:3076
    F https://suttacentral.net/main.js:3076
    update https://suttacentral.net/main.js:2849
    performUpdate https://suttacentral.net/main.js:46
    scheduleUpdate https://suttacentral.net/main.js:46
    _$EP https://suttacentral.net/main.js:46
    requestUpdate https://suttacentral.net/main.js:46
    set https://suttacentral.net/main.js:46
    __siteLanguageChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3035
    connectedCallback https://suttacentral.net/main.js:3996
    O https://suttacentral.net/main.js:3076
    T https://suttacentral.net/main.js:3076
    $ https://suttacentral.net/main.js:3076
    _$AI https://suttacentral.net/main.js:3076
    F https://suttacentral.net/main.js:3076
    update https://suttacentral.net/main.js:2849
    performUpdate https://suttacentral.net/main.js:46
    scheduleUpdate https://suttacentral.net/main.js:46
    _$EP https://suttacentral.net/main.js:46
    requestUpdate https://suttacentral.net/main.js:46
    set https://suttacentral.net/main.js:46
    __siteLanguageChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3996
    stateChanged https://suttacentral.net/main.js:3996
    connectedCallback https://suttacentral.net/main.js:3996
    connectedCallback https://suttacentral.net/main.js:3996
    9770 https://suttacentral.net/main.js:3996
    a https://suttacentral.net/main.js:3996
    9770 https://suttacentral.net/main.js:3958
    d https://suttacentral.net/main.js:3996
    <anonymous> https://suttacentral.net/main.js:3996
    <anonymous> https://suttacentral.net/main.js:3996
 main.js:3183:646
Content-Security-Policy: The page’s settings blocked the loading of a resource (connect-src) at https://sentry.io/api/358981/store/ because it violates the following directive: “connect-src 'self' https://api.stripe.com https://js.stripe.com https://cloudflareinsights.com https://hcaptcha.com https://*.hcaptcha.com https://raw.githubusercontent.com/suttacentral/editions/main/last_run_date https://*.algolia.net https://*.algolianet.com https://*.algolia.io” 2 main.js:46:9757

This appears to only be a problem on a freshly loaded home page. Does not happen on other site pages.

@HongDa ?

4 Likes

Got it, let me check it.

2 Likes

@Snowbird I have fixed this bug.

5 Likes

Thank you!

Wow. it seems to already be live? @Jasudho could you also test? You will have to refresh using Ctrl + Shiftl + R

3 Likes

Yes, I have pushed the change to server.

2 Likes

Tried this morning EST and it works fine.

Many thanks @HongDa and @Snowbird! :folded_hands:

3 Likes

For reference, this was fixed in fix: ensure methods are called safely on scActionItems in hideTopShee… · suttacentral/suttacentral@6d7d927 · GitHub .

This was actually an indirect bug caused by a prior refactor PR of mine, which, unintuitively, didn’t touch the components where the fix landed. Sorry about that! Thanks to the folks here for reporting it and HongDa for fixing that!

If you’re interested in a root cause analysis and how the unintuitive code should be further refactored to avoid this class of problem entirely, see a comment I left there

3 Likes