Skip to content

feat: add refresh ability to GitHub RHS sidebar#1026

Open
rafaumeu wants to merge 1 commit into
mattermost:masterfrom
rafaumeu:feature/refresh-rhs-131
Open

feat: add refresh ability to GitHub RHS sidebar#1026
rafaumeu wants to merge 1 commit into
mattermost:masterfrom
rafaumeu:feature/refresh-rhs-131

Conversation

@rafaumeu

@rafaumeu rafaumeu commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Adds the ability to refresh data in the GitHub plugin RHS sidebar, as requested in #131.

Two improvements:

  1. Auto-refresh on open - When the RHS is opened, getSidebarContent is called automatically to guarantee the latest data is available.
  2. Manual refresh button - A refresh icon (fa-refresh with tooltip) is added to the RHS header. Clicking it triggers getSidebarContent with a spinner animation while loading.

Resolves #131

Changes

  • sidebar_right/index.jsx: Wire getSidebarContent action to SidebarRight
  • sidebar_right/sidebar_right.jsx: Add refresh state, handler, auto-refresh on mount, and refresh button in header

Release Notes

Added the ability to manually refresh and auto-refresh data in the GitHub RHS sidebar.

Change Impact: 🟡 Medium

Reasoning: The update is localized to the GitHub plugin sidebar, but it changes sidebar loading behavior by triggering refresh on open and adding a new manual refresh action with async state handling. That creates some regression risk around rendering, loading indicators, and repeated fetch behavior, though it does not affect shared auth, persistence, or core application flows.

Regression Risk: Moderate. The affected path is user-facing and includes new lifecycle-driven network requests plus UI state transitions, so edge cases like repeated opens, concurrent refresh clicks, or loading state cleanup should be validated.

QA Recommendation: Perform focused manual QA on the sidebar open flow and refresh button behavior, including spinner display, tooltip, repeated clicks, and ensuring existing sidebar content still loads correctly. Skipping manual QA is not recommended.
Generated by CodeRabbitAI

- Add refresh button in RHS header with spinner animation
- Auto-refresh data when RHS is opened
- Wire getSidebarContent action to SidebarRight component

Resolves mattermost#131
@rafaumeu rafaumeu requested a review from a team as a code owner June 16, 2026 22:16
@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @rafaumeu,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f50a42f7-bf80-41b9-8d3d-f38abd61f3ff

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd47fb and 1dee6ca.

📒 Files selected for processing (2)
  • webapp/src/components/sidebar_right/index.jsx
  • webapp/src/components/sidebar_right/sidebar_right.jsx

📝 Walkthrough

Walkthrough

Adds a manual refresh capability to the GitHub plugin's right-hand sidebar. getSidebarContent is wired into SidebarRight via Redux. The component gains a refreshing state, an async handleRefresh method, auto-refresh on open, and a spinning refresh icon in the section header with a tooltip.

Sidebar Right Refresh Feature

Layer / File(s) Summary
Action wiring in container
webapp/src/components/sidebar_right/index.jsx
Imports getSidebarContent from actions and adds it to bindActionCreators in mapDispatchToProps.
Refresh state and handler
webapp/src/components/sidebar_right/sidebar_right.jsx
Adds constructor with refreshing state, async handleRefresh with concurrent-refresh guard, componentDidMount auto-refresh, and OverlayTrigger/Tooltip imports.
Refresh icon and header layout
webapp/src/components/sidebar_right/sidebar_right.jsx
Renders a tooltip-wrapped anchor with spinning refresh icon in the header; updates sectionHeader to flexbox and adds refreshButton cursor/color styles.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the sidebar wakes,
A spinner spins for data's sake!
Click the icon, watch it whirl,
Fresh PRs unfurl and twirl.
No stale data, just delight —
The rabbit refreshes everything right! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise, specific, and matches the main change: adding refresh support to the GitHub RHS sidebar.
Linked Issues check ✅ Passed The PR satisfies #131 by refreshing on RHS open and adding a manual refresh action in the sidebar header.
Out of Scope Changes check ✅ Passed The changes stay focused on RHS refresh behavior and related UI wiring, with no obvious unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mattermost-build

Copy link
Copy Markdown
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@nang2049 nang2049 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you so much @rafaumeu for your contribution. I left a few comments :)


componentDidMount() {
// Auto-refresh on open to guarantee latest data (issue #131)
this.handleRefresh();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The auto refresh on mount is redundant because getSidebarContent() is already dispatched from sidebar_buttons.jsx:42 and websocket/index.js:74,84. By the time the RHS opens the data is fresh.

This adds an extra GitHub search call every time the user opens the RHS, which is expensive. I'd suggest removing the auto refresh entirely and relying on the manual button and existing WS-driven updates. If you want to keep it, please mirror the E2E guard from sidebar_buttons.jsx.

this.state = {refreshing: false};
}

handleRefresh = async (e) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see a couple of issues here. setState is async so two fast clicks can both pass the this.state.refreshing check before either update lands. Use an instance flag for the gate. We also need unmount safety.

Suggested rewrite:

componentDidMount() {
    this._mounted = true;
    // ...
}
componentWillUnmount() {
    this._mounted = false;
}
handleRefresh = async (e) => {
    e?.preventDefault();
    if (this._refreshing) {
        return;
    }
    this._refreshing = true;
    this.setState({refreshing: true});
    try {
        await this.props.actions.getSidebarContent();
    } finally {
        this._refreshing = false;
        if (this._mounted) {
            this.setState({refreshing: false});
        }
    }
};

placement='left'
overlay={<Tooltip id='rhsRefreshTooltip'>{'Refresh'}</Tooltip>}
>
<a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

alignItems: 'center',
},
refreshButton: {
color: 'rgba(0, 0, 0, 0.4)',

@nang2049 nang2049 Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hard-coded color will be invisible on dark themes. this.props.theme is already available on the component please derive the color the same way sidebar_buttons.jsx does. Please convert the bottom-of-file style object to a memoized factory:

import {makeStyleFromTheme, changeOpacity} from 'mattermost-redux/utils/theme_utils';
const getStyle = makeStyleFromTheme((theme) => ({
    sectionHeader: {
        padding: '15px',
        display: 'flex',
        justifyContent: 'space-between',
        alignItems: 'center',
    },
    refreshButton: {
        color: changeOpacity(theme.centerChannelColor, 0.6),
        cursor: 'pointer',
        background: 'transparent',
        border: 'none',
        padding: 0,
    },
}));

const style = {
sectionHeader: {
padding: '15px',
display: 'flex',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This switches every RHS state's header to flex layout not just the ones with the refresh button. Could you attach screenshots of all four states (PRS, REVIEWS, UNREADS, ASSIGNMENTS) on both light and dark themes? Want to make sure the title alignment doesn't regress anywhere.

@nang2049

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Refresh ability to RHS

3 participants