Skip to content

Conversation

@wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Oct 24, 2025

This is a follow up for #35662, and also fix #31181, help #30275, fix #31161

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 24, 2025
@github-actions github-actions bot added modifies/templates This PR modifies the template files modifies/frontend labels Oct 24, 2025
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Oct 24, 2025

The "loading" state is still useful.

When I use GitHub, when my network lags, there is no UI response (no loading) when I hover the issue links, it looks unclear to me.


image
image

@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 Oct 24, 2025
@lunny lunny added this to the 1.26.0 milestone Oct 24, 2025
@Yakov5776
Copy link
Contributor

The "loading" state is still useful.

When I use GitHub, when my network lags, there is no UI response (no loading) when I hover the issue links, it looks unclear to me.

GitHub doesn't highlight the issue if it doesn't exist though, so how does it look unclear?

As seen here:
Yakov5776/symlink-tests#1

@wxiaoguang
Copy link
Contributor Author

The "loading" state is still useful.
When I use GitHub, when my network lags, there is no UI response (no loading) when I hover the issue links, it looks unclear to me.

GitHub doesn't highlight the issue if it doesn't exist though, so how does it look unclear?

I mean when my network lags, I didn't change the "issue not exist" case, it can be optimized separately.

@silverwind
Copy link
Member

silverwind commented Oct 27, 2025

Can the fetch inside ContextPopup.vue be moved outside? I still prefer to use dumb "render only" components where possible, it was the original idea in #31181.

<div v-else-if="issue" class="tw-flex tw-flex-col tw-gap-2">
<div class="tw-text-12">
<a :href="repoLink" class="muted">{{ issue.repository.full_name }}</a>
on {{ createdAt }}
Copy link
Member

@silverwind silverwind Oct 27, 2025

Choose a reason for hiding this comment

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

on needs translation ideally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, ideally.

But I think it doesn't need to be in this PR's scope.

Handling i18n with datetime is also tricky, especially here it is done on frontend and mixes HTML elements.

Leave it to the future (and I don't see anyone complains)

Copy link
Member

Choose a reason for hiding this comment

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

I think we dealt with on before related to relative-time-element, but it's probably all backend rendering there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, relative-time-element has dropped the "on" feature, it is non-translatable.

@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Oct 27, 2025

Can the fetch inside ContextPopup.vue be moved outside? I still prefer to use dumb "render only" components where possible, it was the original idea in #31181.

I don't think so. If you move it out, then the "loading" indicator state will be more complex. I believe the "loading" indicator is useful. And since we haven't resolved the "non-existing issue" problem, the "not found" error is also handled there.

I think the current approach is good enough

@silverwind
Copy link
Member

If you move it out, then the "loading" indicator state will be more complex

Could just pass a loading: boolean prop to the component, but I guess it's not a big issue.

@wxiaoguang
Copy link
Contributor Author

If you move it out, then the "loading" indicator state will be more complex

Could just pass a loading: boolean prop to the component, but I guess it's not a big issue.

Then how could you switch the "loading" prop? Vue doesn't work that way.

@silverwind
Copy link
Member

Doesn't vue re-render when props change? At least that's how it works in React.

@wxiaoguang
Copy link
Contributor Author

Doesn't vue re-render when props change? At least that's how it works in React.

If they are all in the reactive context, yes.

But here, the component is mounted from JS by a non-reactive props object. I don't think React works in this case either.

@wxiaoguang
Copy link
Contributor Author

image

@silverwind
Copy link
Member

silverwind commented Oct 27, 2025

Ah yes if you create a whole vue app or react root, then those props won't be reactive. The auto-update behaviour only works when a component renders another component (which is the typical case in a SPA).

@wxiaoguang
Copy link
Contributor Author

Any other questions?

I think this PR is good enough, it resolves many legacy problems, the code is more maintainable, nothing becomes worse.

Although there could be some improvements, but none of them is easy to implement, so the improvements can be left to the future until someone really needs them and can use some right approaches to implement them.


export function getAttachedTippyInstance(el: Element): Instance | null {
return el._tippy ?? null;
}
Copy link
Member

@silverwind silverwind Oct 27, 2025

Choose a reason for hiding this comment

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

Instead of this, can you adjust globals.d.ts to add undefined to the property:

interface Element {
  _tippy: import('tippy.js').Instance | undefined;
}

And then just use el._tippy, typescript will then take care that the undefined case is handled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is very ugly.

I believe in we need to encapsulate the modules, but don't let caller use fragile code.

el._tippy is very fragile, it totally depends the undocumented 3rd party library behavior, should never be widely used.

Copy link
Member

Choose a reason for hiding this comment

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

If you don't want direct el._tippy access, that's fine, but then these 2 cases should also use this function:

web_src/js/features/common-page.ts:62:              queryElems(elDropdown, '.menu > .item', (el) => el._tippy?.hide());
web_src/js/features/repo-issue-list.ts:189:        el._tippy.destroy();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you don't want direct el._tippy access, that's fine, but then these 2 cases should also use this function:

web_src/js/features/common-page.ts:62:              queryElems(elDropdown, '.menu > .item', (el) => el._tippy?.hide());
web_src/js/features/repo-issue-list.ts:189:        el._tippy.destroy();

There are far more, these usages can be refactored later, not in this PR's scope.

image

Copy link
Member

Choose a reason for hiding this comment

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

TBH, I find the typescript solution better, it does not necessitate such big refactors and is equally safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A variable starting with underscore already means it is for internal usage only, it is a widely accepted agreement across many different languages.

Using a variable with underscore prefix really doesn't seem good.

Copy link
Member

@silverwind silverwind Oct 27, 2025

Choose a reason for hiding this comment

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

It's a practical solution in case of tippy, I agree in a ideal world, properties should not be added to Element at all.

We should replace tippy (which is deprecated) with https://github.com/floating-ui/floating-ui.

@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 Oct 27, 2025
@wxiaoguang wxiaoguang merged commit cddff73 into go-gitea:main Oct 27, 2025
26 checks passed
@wxiaoguang wxiaoguang deleted the fix-refissue branch October 27, 2025 14:47
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 modifies/templates This PR modifies the template files type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The PRs link in release page will get network error

5 participants