Skip to content

Fix favorites star spinning indefinitely after click on Project Hub#3364

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-favorites-star-button
Draft

Fix favorites star spinning indefinitely after click on Project Hub#3364
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-favorites-star-button

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 13, 2026

Clicking the favorite star added a go spinner class but hx-swap="none" meant no DOM update ever occurred to remove it, leaving the animation running forever.

Change

Added hx-on::after-request to the favorite button in projectCard.blade.php to remove the go class as soon as the HTMX request settles:

hx-on::after-request="jQuery(this).removeClass('go')"

The star icon state continues to update correctly via the existing HTMX.updateProjectList event fired by toggleFavorite(), which refreshes the project list. No backend changes required.

Original prompt

Fix the favorites star button on the Project Hub page that spins indefinitely after clicking.

Issue: #3363

Root cause: In app/Domain/Projects/Templates/partials/projectCard.blade.php, the favorite button uses:

  • onclick="jQuery(this).addClass('go')" to add a spinner animation
  • hx-swap="none" which prevents htmx from replacing any DOM content
  • The backend toggleFavorite() in app/Domain/Projects/Hxcontrollers/ProjectCard.php fires an HTMX.updateProjectList event, but the go class is never removed because no DOM swap occurs

Fix approach: The simplest fix is to change hx-swap="none" to properly swap the project card content so the spinner is replaced by the updated card. Alternatively, add htmx event hooks to remove the go class after the request completes.

Specifically:

  1. In app/Domain/Projects/Templates/partials/projectCard.blade.php, change the favorite button's hx-swap attribute from "none" to "outerHTML" on the hx-target, OR add an hx-on::after-request attribute that removes the go class: hx-on::after-request="jQuery(this).removeClass('go')"
  2. Ensure the star icon toggles between fa-solid and fa-regular in the response
  3. Do NOT modify any backend logic — the toggleFavorite() method works correctly

Keep the change minimal — only modify the template file to fix the UI feedback loop.

… request

Agent-Logs-Url: https://github.com/Leantime/leantime/sessions/5ba4396d-7eda-4e81-855d-3363981ced87

Co-authored-by: marcelfolaron <47038998+marcelfolaron@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix favorites star button on Project Hub page Fix favorites star spinning indefinitely after click on Project Hub Apr 13, 2026
Copilot AI requested a review from marcelfolaron April 13, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants