Skip to content

Refactor issue sidebar and fix various problems#37045

Merged
wxiaoguang merged 12 commits intogo-gitea:mainfrom
wxiaoguang:refactor-sidebar
Mar 31, 2026
Merged

Refactor issue sidebar and fix various problems#37045
wxiaoguang merged 12 commits intogo-gitea:mainfrom
wxiaoguang:refactor-sidebar

Conversation

@wxiaoguang
Copy link
Copy Markdown
Contributor

@wxiaoguang wxiaoguang commented Mar 30, 2026

Fix various legacy problems, including:

The sidebar refactoring: it is a clear partial-reloading approach, brings better user experiences, and it makes "Multiple projects" / "Project column on issue sidebar" feature easy to be added.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 30, 2026
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Mar 30, 2026
@wxiaoguang wxiaoguang requested a review from Copilot March 30, 2026 17:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the issue sidebar to support partial page reloading (avoiding full-page reloads that can lose in-progress edits) and fixes legacy project/column edge cases (not creating a default column when viewing an empty project).

Changes:

  • Convert issue sidebar initialization to a data-global-init/observer-driven approach so newly inserted sidebar DOM can be re-initialized automatically.
  • Replace sidebar-triggered full page reloads with a “partial reload” that swaps the sidebar and appends new timeline items.
  • Adjust project selection/meta handling to support “multiple projects” groundwork and avoid creating default columns for empty projects.

Reviewed changes

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

Show a summary per file
File Description
web_src/js/features/repo-issue.ts Ensures sidebar init is registered even when comment form isn’t present.
web_src/js/features/repo-issue-sidebar.ts Refactors sidebar init to global-init + sidebar-scoped DOM querying.
web_src/js/features/repo-issue-sidebar-combolist.ts Implements partial reload logic after sidebar updates (GET + DOM replacement).
templates/repo/issue/view_content/sidebar.tmpl Adds data-global-init hook to sidebar container.
templates/repo/issue/new_form.tmpl Adds data-global-init hook to sidebar on new issue/PR form.
templates/repo/issue/sidebar/project_list.tmpl Switches hidden value source to SelectedProjectIDs (multi-project groundwork).
routers/web/repo/issue_page_meta.go Adds project meta retrieval and multi-project fields on page metadata.
routers/web/repo/issue_new.go Parses project as a comma-separated list; adapts metadata accordingly.
models/project/column.go Adds GetDefaultColumnWithFallback and refactors default-column logic.
services/projects/issue.go Uses fallback default-column retrieval; returns empty results for projects with no columns.
models/issues/issue_project.go Removes unused LoadIssuesFromColumn helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silverwind
Copy link
Copy Markdown
Member

How about also removing the branch/tag selector as previously discussed?

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

How about also removing the branch/tag selector as previously discussed?

No, not in this PR's scope, and there are still users saying "they really need it", although I doubt.

Copy link
Copy Markdown
Member

@metiftikci metiftikci left a comment

Choose a reason for hiding this comment

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

thank you for this change

@wxiaoguang wxiaoguang force-pushed the refactor-sidebar branch 2 times, most recently from 2c1b6ea to ed2ee41 Compare March 30, 2026 20:48
Copy link
Copy Markdown
Member

@metiftikci metiftikci left a comment

Choose a reason for hiding this comment

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

Spotless!

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 30, 2026
@lunny
Copy link
Copy Markdown
Member

lunny commented Mar 30, 2026

After some changes on the sidebar and then click subscribe, it will jump to another page with only subscribe button.
image

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

After some changes on the sidebar and then click subscribe, it will jump to another page with only subscribe button.

Damn htmx. -> Proposal: drop htmx #35059

Fix: bbfeee2

@GiteaBot GiteaBot removed the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 30, 2026
@GiteaBot GiteaBot added the lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. label Mar 30, 2026
@metiftikci
Copy link
Copy Markdown
Member

@lunny did you check the fix. i still got the same problem

btw sorry for missed that

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

i still got the same problem

I have checked, the problem is fixed.

How do you build your frontend assets? IIRC the new vite dev server's assets sometimes is still cached on browser side. Maybe you need to refresh to try.

@metiftikci
Copy link
Copy Markdown
Member

issue

here but feel free to ignore my comment

@lunny
Copy link
Copy Markdown
Member

lunny commented Mar 30, 2026

@lunny did you check the fix. i still got the same problem

btw sorry for missed that

Yes, I checked it. I tested it using make build.

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

i still got the same problem

What's your browser? If you don't change label, will there be the same problem?

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

Also cc @yardenshoham do you know how to debug the problem? TBH I have no idea .....

@wxiaoguang wxiaoguang marked this pull request as draft March 31, 2026 00:42
@silverwind
Copy link
Copy Markdown
Member

Should just remove HTMX before touching any more functionalities it touches. I can probably task Claude on it later, should be a pretty safe refactor if e2e tests are used to cover the functionality during the migration.

@wxiaoguang
Copy link
Copy Markdown
Contributor Author

i still got the same problem

What's your browser? If you don't change label, will there be the same problem?

According to your screenshot, I guess you are using Edge. Also tried, still not able to reproduce.

@wxiaoguang wxiaoguang changed the title Refactor issue sidebar Refactor issue sidebar and fix various problems Mar 31, 2026
@wxiaoguang wxiaoguang marked this pull request as ready for review March 31, 2026 01:58
@wxiaoguang
Copy link
Copy Markdown
Contributor Author

wxiaoguang commented Mar 31, 2026

Since this PR is already large enough, and the "sidebar operation -> subscribe -> incorrect page" issue can't be reproduced by others, I think we can merge this as is, and let more people to help to test and figure out the root problem.

  • Even if there is a bug, it isn't serious, it only occurs in the rare case (sidebar operation + subscribe), won't block user's daily use (a fresh page just makes everything work again)
  • If there is anything seriously wrong, I will fix it in first time, including rewriting the htmx related code if needed. No need to worry.

@wxiaoguang wxiaoguang merged commit 6ca5573 into go-gitea:main Mar 31, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 31, 2026
@wxiaoguang wxiaoguang deleted the refactor-sidebar branch March 31, 2026 02:03
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 31, 2026
* main:
  Refactor issue sidebar and fix various problems (go-gitea#37045)
  Add tests for pull request's content_version in API (go-gitea#37044)
  Enable concurrent vitest execution (go-gitea#36998)
  Fix theme discovery and Vite dev server in dev mode (go-gitea#37033)
  bump snapcraft deps (go-gitea#37039)
  Expose content_version for optimistic locking on issue and PR edits (go-gitea#37035)
@metiftikci
Copy link
Copy Markdown
Member

FYI tested main with clean build on new codespace and can not see the problem

silverwind added a commit to silverwind/gitea that referenced this pull request Apr 2, 2026
* origin/main: (192 commits)
  Fix NuGet package upload error handling (go-gitea#37074)
  Desaturate dark theme background colors (go-gitea#37056)
  Update JS dependencies and misc tweaks (go-gitea#37064)
  Redirect to the only OAuth2 provider when no other login methods and fix various problems (go-gitea#36901)
  Show workflow link (go-gitea#37070)
  Remove leftover `webpackChunkName` comments from codeeditor (go-gitea#37062)
  Update Go dependencies (go-gitea#36781)
  Add webhook name field to improve webhook identification (go-gitea#37025) (go-gitea#37040)
  Upgrade `go-git` to v5.17.2 (go-gitea#37060)
  Replace Monaco with CodeMirror (go-gitea#36764)
  Update Combine method to treat warnings as failures and adjust tests (go-gitea#37048)
  Raise minimum Node.js version to 22.18.0 (go-gitea#37058)
  Update golangci-lint to v2.11.4 (go-gitea#37059)
  Upgrade `golang.org/x/image` to v0.38.0 (go-gitea#37054)
  Increase e2e test timeouts on CI to fix flaky tests (go-gitea#37053)
  Refactor "org teams" page and help new users to "add member" to an org (go-gitea#37051)
  Refactor issue sidebar and fix various problems (go-gitea#37045)
  Add tests for pull request's content_version in API (go-gitea#37044)
  Enable concurrent vitest execution (go-gitea#36998)
  Fix theme discovery and Vite dev server in dev mode (go-gitea#37033)
  ...

# Conflicts:
#	templates/user/dashboard/feeds.tmpl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/docs modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants