Skip to content

Added spinner on retrieving bind key in the client#388

Merged
tuj merged 9 commits into
release/3.0.0from
feature/spinner-on-retrieving-bind-key
Apr 30, 2026
Merged

Added spinner on retrieving bind key in the client#388
tuj merged 9 commits into
release/3.0.0from
feature/spinner-on-retrieving-bind-key

Conversation

@tuj

@tuj tuj commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Link to issue

#380

Link to ticket

https://leantime.itkdev.dk/#/tickets/showTicket/7203

Description

Builds on #387

Added spinner on retrieving bind key in the client.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@tuj
tuj requested a review from turegjorup April 18, 2026 08:45
@tuj tuj self-assigned this Apr 18, 2026
@tuj tuj added bug Something isn't working version 3 Issues related to the release of version 3 labels Apr 18, 2026

@turegjorup turegjorup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Refactor and the UNKNOWN/default fix look good — that case previously froze the polling loop, which is a real fix worth highlighting.

Bug

  • Spinner shows on top of admin previews. retrievingBindKey is initialized to true and only cleared in startContent and the READY/AWAITING_BIND_KEY branches. For non-screen preview modes (slide, playlist, theme, …), useEffect skips startContent and never touches the flag, so retrievingBindKey && !bindKey stays true and the spinner sits in the bottom-right corner of every admin preview. Suggest gating on !preview or initializing from preview === null. (app.jsx:299-303)

Nits

  • .catch in checkLogin doesn't clear retrievingBindKey, so a degraded API leaves the spinner running forever with no error surfaced. Probably intentional, but worth a comment. (app.jsx:148-150)
  • Test file app-reauth.test.jsx contains two describes, only one of which is about reauth — the other is about UNKNOWN-status polling. Rename or split.
  • Neither test actually asserts on the spinner element (the headline feature). One expect(document.querySelector(".retrieving-bind-key-spinner")).toBeInTheDocument() before/after would close that gap.
  • @keyframes spin is declared globally in app.scss. No collision today, but a more specific name (e.g. bind-key-spin) avoids future ones.

@turegjorup turegjorup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Posting the earlier findings as inline suggestions for easier action. See top-level review for rationale; comments below carry the concrete diffs.

Comment thread assets/client/app.jsx Outdated
Comment thread assets/client/app.jsx
break;
}
})
.catch(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the .catch handler below doesn't clear retrievingBindKey, so a degraded API leaves the spinner running indefinitely with no error surfaced. Probably intentional (we're still trying), but worth a one-line comment explaining the choice — or surfacing statusService.setError(...) on repeated failures.

Comment thread assets/client/app.scss Outdated
await act(async () => {});
}

describe("checkLogin retries on unknown status", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: this describe is about polling on LOGIN_STATUS_UNKNOWN, not reauth — the file name app-reauth.test.jsx is misleading. Either rename the file (e.g. app-bind-key.test.jsx) or split the unknown-status case into its own file.

await tick(0);

// Bind key should NOT be visible yet (unknown status, no bind key set).
expect(screen.queryByText("BIND42")).not.toBeInTheDocument();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: the headline feature of this PR is the spinner, but neither test asserts on the spinner element. Easy gap to close:

Suggested change
expect(screen.queryByText("BIND42")).not.toBeInTheDocument();
expect(screen.queryByText("BIND42")).not.toBeInTheDocument();
expect(document.querySelector(".retrieving-bind-key-spinner")).toBeInTheDocument();

And a complementary not.toBeInTheDocument() after the bind key arrives at line 140.

tuj and others added 4 commits April 30, 2026 12:41
@tuj
tuj requested a review from turegjorup April 30, 2026 11:17
@tuj
tuj merged commit a698694 into release/3.0.0 Apr 30, 2026
17 checks passed
@tuj
tuj deleted the feature/spinner-on-retrieving-bind-key branch April 30, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working version 3 Issues related to the release of version 3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants