Skip to content

Use shallowRef instead of ref in .vue files where possible #34813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 22, 2025

Conversation

kilisei
Copy link
Contributor

@kilisei kilisei commented Jun 21, 2025

Reference:

This PR improves some .vue components by using shallowRef instead of ref, which should improve performance. It's probably not significant, but it's an improvement because Vue no longer deep watches the ref (shallowRef).
Also i used useTemplateRef instead of ref

I tested it locally, but I could have missed something, so please test it on your machine. Thank you!

  • Linted frontend

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 21, 2025
@lunny lunny requested a review from kerwin612 June 21, 2025 22:28
@kilisei
Copy link
Contributor Author

kilisei commented Jun 22, 2025

I just looked at the code again, and I think there are a few more places where we can use shallowRef. I can't get my local gitea environment to work, so please check these changes they seam logical to me. I tried to quadruple-check, but I'm sometimes stupid. Please test it. :)

Copy link
Contributor

@wxiaoguang wxiaoguang 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 very much.

The code was refactored from Vue2 by many steps, so some bad smells were left there. 😄

@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 Jun 22, 2025
@kilisei kilisei requested a review from wxiaoguang June 22, 2025 13:01
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

Great work, thank you very much.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 22, 2025
@wxiaoguang wxiaoguang merged commit 181db69 into go-gitea:main Jun 22, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.25.0 milestone Jun 22, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 23, 2025
* giteaofficial/main: (22 commits)
  [skip ci] Updated translations via Crowdin
  Fix required contexts and commit status matching bug (go-gitea#34815)
  Add "Cancel workflow run" button to Actions list page (go-gitea#34817)
  Use `shallowRef` instead of `ref` in `.vue` files where possible (go-gitea#34813)
  Edit file workflow for creating a fork and proposing changes (go-gitea#34240)
  Refactor packages (go-gitea#34777)
  Refactor wiki (go-gitea#34805)
  [skip ci] Updated translations via Crowdin
  Upgrade htmx to 2.0.5 (go-gitea#34809)
  Forks repository list page follow other repositories page (go-gitea#34784)
  Add post-installation redirect based on admin account status (go-gitea#34493)
  Rework delete org and rename org UI (go-gitea#34762)
  Refactor editor (go-gitea#34780)
  Improve img lazy loading (go-gitea#34804)
  [skip ci] Updated translations via Crowdin
  Fix Feishu webhook signature verification (go-gitea#34788)
  Upgrade chi to v5.2.2 (go-gitea#34798)
  Fix the issue of abnormal interface when there is no issue-item on the project page (go-gitea#34791)
  Fix container range bug (go-gitea#34795)
  Fix OCI manifest parser (go-gitea#34797)
  ...
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/frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants