Skip to content

status-subscription - Improve reliability#9849

Merged
fregante merged 19 commits into
mainfrom
status-svelte
Jul 18, 2026
Merged

status-subscription - Improve reliability#9849
fregante merged 19 commits into
mainfrom
status-svelte

Conversation

@fregante

@fregante fregante commented Jul 17, 2026

Copy link
Copy Markdown
Member

@fregante
fregante marked this pull request as ready for review July 17, 2026 19:06
@fregante

Copy link
Copy Markdown
Member Author

Claude's doing a pretty good job at moving only the JSX to svelte, keeping it mostly logic-free. This already seems to work

Comment on lines -61 to -81
subscriptionButton.after(
<div className="rgh-status-subscription BtnGroup d-flex width-full">
{tooltipped(
{label: 'Unsubscribe', direction: 'sw'},
<Button value="unsubscribe" {...(status === 'none' && disableAttributes)}>
<BellSlashIcon /> None
</Button>,
)}
{tooltipped(
{label: 'Subscribe to all events', direction: 'sw'},
<Button value="subscribe" {...(status === 'all' && disableAttributes)}>
<BellIcon /> All
</Button>,
)}
{tooltipped(
{label: multilineAriaLabel('Subscribe just to status changes', '(closing, reopening, merging)'), direction: 'sw'},
<Button value="subscribe_to_custom_notifications" {...(status === 'status' && disableAttributes)}>
<IssueReopenedIcon /> Status
</Button>,
)}
</div>,

@fregante fregante Jul 17, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Broken JSX, inline spreads, pretty ugly overall. This is basically the only reason to consider svelte in status-subscription though, it's easier to have this sort of logic in svelte.

Not to mention that it was copy-pasted between the legacy and current version to simplify cleanup later on.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the only reason

I didn't notice, but actually the component was removed and re-rendered at every click. Svelte now updates the widget instead of calling addButton recursively 🎉


.rgh-clean-sidebar .thread-subscription-status .reason {
margin: 0 0 10px !important;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ancient style from #2443

Comment on lines +37 to +41
// TODO: Move to CSS after legacy version is dropped
function toggleSubscriptionReason(status: SubscriptionStatus): void {
// 'all' can have many reasons, but the other two don't add further information #6684
getSubscriptionReasonElement().hidden = status !== 'all';
}

@fregante fregante Jul 18, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This behavior was missing from the new version. Classifying this PR as bugfix

toggleSubscriptionReason(target);
} finally {
disabled.set(false);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe this whole logic can be moved in the component once the legacy version is gone (see you in 2028)

Comment on lines -157 to -159
closestElement('fieldset', event.currentTarget).disabled = true;
await updateSubscription(target, id);
void addButton(subscriptionButton);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Major change: instead of calling addButton recursively, the widget is now stateful and is updated instead of generated from scratch at every click.

@fregante fregante changed the title status-subscription - Svelte component status-subscription - Improve reliability Jul 18, 2026
@fregante fregante added the bug label Jul 18, 2026
value="subscribe_to_custom_notifications"
icon={IssueReopenedIcon}
label="Status"
tooltip="Subscribe only to closing, reopening, merging"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also shortened the label and dropped the sw direction since now it automatically fits the viewport

@fregante
fregante merged commit 543c941 into main Jul 18, 2026
13 checks passed
@fregante
fregante deleted the status-svelte branch July 18, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant