-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Fix elipsis button not working if the last commit loading is deferred #29544
Merged
Commits on Mar 2, 2024
-
Fix elipsis button not working if the last commit loading is deferred
Before this change, if we had more than 200 entries being deferred in loading, the entire table would get replaced thus losing any event listeners attached to the elements within the table, such as the elipsis button and commit list with tippy. With this change we remove the previous javascript code that replaced the table and use htmx to replace the table. htmx attributes added: - `hx-indicator="tr.notready td.message span"`: attach the loading spinner to the files whose last commit is still being loaded - `hx-trigger="load[this.querySelectorAll('tr.notready').length > 0]"` trigger the request-replace behavior as soon as possible and only if the current table is showing files that haven't had their latest commit info loaded. If this inline javascript doesn't look good I can change it so the backend doesn't render the htmx attributes if it's an htmx request, and the trigger would simply be `load` but I like it as it is now - `hx-swap="morph"`: use the idiomorph morphing algorithm, this is the thing that makes it so the elipsis button event listener is kept during the replacement, fixing the bug - `hx-post="{{.LastCommitLoaderURL}}"`: make a post request to this url to get the table with all of the commit information As part of this change I removed the handling of partial replacement in the case we have less than 200 "not ready" files. The first reason is that I couldn't make htmx replace only a subset of returned elements, the second reason is that we have a cache implemented in the backend already so the only cost added is that we query the cache a few times (which is sure to be populated due to the initial request), and the last reason is that since the last refactor of this functionality that removed jQuery we don't properly send the "not ready" entries as the backend expects `FormData` with `f[]` and we send a JSON with `f` so we always query for all rows anyway. Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Configuration menu - View commit details
-
Copy full SHA for f0710c5 - Browse repository at this point
Copy the full SHA f0710c5View commit details -
Configuration menu - View commit details
-
Copy full SHA for c5098d2 - Browse repository at this point
Copy the full SHA c5098d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0f5d7d9 - Browse repository at this point
Copy the full SHA 0f5d7d9View commit details -
Configuration menu - View commit details
-
Copy full SHA for aa73b74 - Browse repository at this point
Copy the full SHA aa73b74View commit details -
Update routers/web/repo/view.go
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for b6e65a7 - Browse repository at this point
Copy the full SHA b6e65a7View commit details -
Update templates/repo/view_list.tmpl
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 09efb7a - Browse repository at this point
Copy the full SHA 09efb7aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8bd082b - Browse repository at this point
Copy the full SHA 8bd082bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 50e480e - Browse repository at this point
Copy the full SHA 50e480eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad98672 - Browse repository at this point
Copy the full SHA ad98672View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.