Skip to content

conversation-activity-filter - Clean up state - #9999

Merged
fregante merged 18 commits into
mainfrom
conversation-activity-state-unity
Aug 31, 2026
Merged

fregante merged 18 commits into
mainfrom
conversation-activity-state-unity

Conversation

@fregante

@fregante fregante commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Test URLs

Screenshot

Tested, all good

This comment was marked as resolved.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@fregante
fregante marked this pull request as ready for review August 24, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment on lines +43 to +48
$([
// PR
'[class^="prc-PageLayout-PageLayoutWrapper"]',
// Issue
'[class*="IssueViewer-module__mainContainer"]',
]).setAttribute('data-rgh-conversation-activity-filter', value);
Comment thread source/helpers/svelte.ts Resolved
@fregante

Copy link
Copy Markdown
Member Author

Tested a few things:

  • state is reset when ajaxing to new issue
  • state is preserved on back button

Broken:

@fregante

Copy link
Copy Markdown
Member Author

@copilot the minorFixesIssuePages defaults are overriding all choices, the state can't be changed

This comment was marked as low quality.

@fregante

Copy link
Copy Markdown
Member Author

@copilot the minorFixesIssuePages defaults are overriding all choices, the state can't be changed. Ignore previous comments, only read this and address it

This comment was marked as spam.

@fregante
fregante force-pushed the conversation-activity-state-unity branch 2 times, most recently from 32dac60 to 3d77f84 Compare August 30, 2026 08:48
@fregante
fregante requested a balanced review from Copilot August 31, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

'https://github.com/refined-github/refined-github/issues/7000',
'https://github.com/refined-github/refined-github/issues/7777',
'https://github.com/refined-github/refined-github/issues/8000',
];

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.

Dropped some closed issues

// Find and hide stale reviews referenced by dismissed review events
for (const {hash: staleReviewId} of $$('.TimelineItem-body > a[href^="#pullrequestreview-"]', item)) {
closestElement(timelineItem, $(staleReviewId))
$(is(timelineItem) + has(staleReviewId))

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.

One query

target: anchor,
props: {
onStateChange: applyState,
},

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.

Now the state is controlled directly. The component used to read from the store, so why not set the store internally?

Comment on lines 130 to -174
async function init(signal: AbortSignal): Promise<void> {
const initialState = SessionPageSetting.get()
?? (minorFixesIssuePages.some(url => location.href.startsWith(url))
? 'hideAllNoise' // Automatically hide resolved comments on "Minor codebase updates and fixes" issue pages
: 'showAll');
activityFilterState.set(initialState);

const initialSetupOnce = onetime(() => {
if (initialState !== 'showAll') {
applyState(initialState);
}

registerHotkey('h', switchToNextFilter, {signal});
});

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.

Very hard to follow.

Now:

  1. init updates the store

Period. The store itself will know its own defaults and where to read any stored state

registerHotkey('h', switchToNextFilter, {signal});

globalThis.addEventListener('hashchange', uncollapseTargetedComment, {signal});
observe(timeline, syncWrapper, {signal});

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 call somewhat replaces initialSetupOnce as it subscribes the timeline's attribute directly to the store.

Comment on lines +21 to +26
function getInitialStateForUrl(pathname: string): State {
const initialState = sessionStorage.getItem(sessionKey(pathname))
?? defaults.get(pathname)
?? 'showAll';
return initialState as State;
}

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.

Name and flow extremely clear now.

@fregante
fregante merged commit 87157e0 into main Aug 31, 2026
27 checks passed
@fregante
fregante deleted the conversation-activity-state-unity branch August 31, 2026 12:11
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.

3 participants