Skip to content

Conversation

@mxmou
Copy link
Member

@mxmou mxmou commented Nov 12, 2025

Changes

Scratch will remove the About link from the navigation bar and add a new Membership link instead, which will only be visible when logged out. This PR updates the customizable navigation bar addon accordingly:

  • Rewrites the userscript for scratch-www pages to fix a crash
  • Adds a new setting controlling whether each link is always visible or only when (not) logged in
  • Updates the default settings

Tests

Tested locally on Edge.

@mxmou mxmou self-assigned this Nov 12, 2025
@mxmou mxmou added scope: addon Related to one or multiple addons scope: webpages Related to the web pages (settings page, pop-up, etc) scope: upstream Related to something we depend on (like Scratch, a library, or the browser) labels Nov 12, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code crashes on www pages because:

  • When the page is initially loaded, the Membership link is shown.
  • The addon runs and removes all the links, replacing them with new elements.
  • Then, when the session data is loaded, React tries to remove the Membership link. Since the element has already been removed by the addon, this causes a crash.

I've rewritten it to override the navbar's render function instead of modifying the DOM directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of crash does the old code trigger? Does the page stop working?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of crash does the old code trigger? Does the page stop working?

It shows the full-screen "Scratch has crashed" message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't repro with just discuss-button or all addons enabled.

@DNin01 DNin01 added the priority: 1 Critical. Includes security bugs and release blockers label Nov 13, 2025
@mxmou
Copy link
Member Author

mxmou commented Nov 14, 2025

We'll need to decide what to do with existing users' settings: should they be kept (in that case, the new setting should be turned off for them) or should the About item be removed?

I've moved them to a separate PR since they're no longer needed here.
@WorldLanguages
Copy link
Member

Please ping me when this is done so that we can release a new version

@DNin01
Copy link
Member

DNin01 commented Nov 15, 2025

We'll need to decide what to do with existing users' settings: should they be kept (in that case, the new setting should be turned off for them) or should the About item be removed?

I quickly added a setting update: if after the update the addon settings contain an item with a URL of "/about", it is removed.

(If we release this patch before Scratch adds the Membership button, then if a user has this addon enabled, that button will appear on their nav bar early. It'll also go to a "not found" page, but that's better than crashing the site.)

@DNin01
Copy link
Member

DNin01 commented Nov 15, 2025

@WorldLanguages, I think the PR is ready.

Things to cherry-pick for this next hotfix (v1.44.2):

@DNin01 DNin01 merged commit 5656ffd into ScratchAddons:master Nov 16, 2025
3 checks passed
DNin01 added a commit that referenced this pull request Nov 16, 2025
* discuss-button: support new Membership link

* Separate "Show Membership link" setting

* Revert settings page changes

I've moved them to a separate PR since they're no longer needed here.

* Migrate discuss-button settings

---------

Co-authored-by: DNin01 <106490990+DNin01@users.noreply.github.com>
@DNin01
Copy link
Member

DNin01 commented Nov 16, 2025

@WorldLanguages I've already done the cherry-picking and prepared the next hotfix on branch v1.44.x for you to release.

@mxmou mxmou deleted the membership-page branch November 19, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: 1 Critical. Includes security bugs and release blockers scope: addon Related to one or multiple addons scope: upstream Related to something we depend on (like Scratch, a library, or the browser) scope: webpages Related to the web pages (settings page, pop-up, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v1.44.2 fixed] discuss-button conflict with Membership link resulting in crash

5 participants