-
-
Couldn't load subscription status.
- Fork 6.2k
Make ContextPopup stateless, improve fetching logic
#31181
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
Conversation
ContextPopup stateless
|
In 434287a I added another data attribute to track the loading state, ensuring this will never issue two GET requests at the same time for the same link, no matter which DOM events trigger on the link. |
ContextPopup statelessContextPopup stateless, improve fetching logic
|
Sorry but I do not think the change is good enough. When you'd like to reuse an existing instance, all states should be handled carefully. For example
I do not think it's worth to force it only use one instance. I strongly prefer the old approach, which is simple enough and doesn't really cause any problem. |
I wouldn't say it is a serious problem, and it could be fixed by add some "hiding" code. |
|
The problem with double tooltip can also be seen with the commit status in commit list. I think it could be fixed by adding a |
|
Is it sill active? I do not see the edge cases in #31181 (comment) could be addressed clearly. |
The old approach at least causes this problem of cached error state on back button: Also, a stateless component is much simpler than a stateful one, imho. |
|
-> Fix "ref-issue" handling in markup #35739 |
| } | ||
|
|
||
| export function initContextPopups() { | ||
| // TODO: Use MutationObserver to detect newly inserted .ref-issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need any new MutationObserver now.
My data-global-init framework works pretty well in #35739, and more and more global manually-called init functions can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does data-global-init detect new content from edits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-global-init is handled by a unique global MutationObserver, explained in Refactor global init code and add more comments #33755
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, global shared MutationObserver is also fine.
This is a follow up for go-gitea#35662, and also fix go-gitea#31181, help go-gitea#30275, fix go-gitea#31161
This is a follow up for go-gitea#35662, and also fix go-gitea#31181, help go-gitea#30275, fix go-gitea#31161

ContextPopupis now a stateless component, accepting only props to render the popuptooltiprole which enables singleton behaviour, so multiple such popups won't show at the same time (happens when links are close together)interactiveBorderto 15pxFixes: #31161
Helps with: #30275
Popup over existing issue:
Nonexisting issue does not show anything:
I think this is a nice bugfix for 1.22.