org details pending invites - #1862
Conversation
panel and extract org role fetching into useOrganizationRoles
…s-pending-invites
…s-pending-invites
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughChangesOrganization invitation flows
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c5ddb944-9e6a-49ab-b1dc-2266b50a17c5
📒 Files selected for processing (11)
web/sdk/admin/hooks/useOrganizationRoles.tsweb/sdk/admin/utils/connect-timestamp.tsweb/sdk/admin/views/organizations/details/index.tsxweb/sdk/admin/views/organizations/details/members/index.tsxweb/sdk/admin/views/organizations/details/members/invited-members-columns.tsxweb/sdk/admin/views/organizations/details/members/invited-members-dialog.tsxweb/sdk/admin/views/organizations/details/members/members.module.cssweb/sdk/admin/views/organizations/details/members/remove-invite-dialog.tsxweb/sdk/admin/views/users/details/layout/membership-dropdown.tsxweb/sdk/admin/views/users/details/layout/side-panel-invitation.tsxweb/sdk/admin/views/users/details/layout/side-panel.tsx
| // Not in the dialog: the toolbar needs the count before it mounts. | ||
| const { | ||
| data: invitations = NO_INVITATIONS, | ||
| isLoading: isInvitationsLoading, | ||
| } = useQuery( | ||
| FrontierServiceQueries.listOrganizationInvitations, | ||
| create(ListOrganizationInvitationsRequestSchema, { | ||
| orgId: organizationId, | ||
| }), | ||
| { | ||
| enabled: !!organizationId, | ||
| select: data => data?.invitations || NO_INVITATIONS, | ||
| }, | ||
| ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not render an invitation-query failure as an empty list.
When this query fails, invitations becomes NO_INVITATIONS. showInvitesBtn then hides the only pending-invites entry point. Render an error and retry state, and do not report that no invitations exist until the query succeeds.
| >; | ||
| } | ||
|
|
||
| const seconds = (timestamp?: TimeStamp) => Number(timestamp?.seconds ?? 0); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,140p' web/sdk/admin/utils/connect-timestamp.ts
rg -n -C 3 'type TimeStamp|interface TimeStamp|nanos|Timestamp' \
web/sdk/admin/utils/connect-timestamp.ts \
web/sdk/admin/views/organizations/details/members/invited-members-columns.tsxRepository: raystack/frontier
Length of output: 7980
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the sortable columns and any nearby helper usages without executing repo code.
sed -n '1,95p' web/sdk/admin/views/organizations/details/members/invited-members-columns.tsx
# Programmatically check the exact helper shape and comparator expressions from the file as text.
python3 - <<'PY'
from pathlib import Path
p = Path('web/sdk/admin/views/organizations/details/members/invited-members-columns.tsx')
text = p.read_text()
print('seconds_function:', 'const seconds = (timestamp?: TimeStamp) => Number(timestamp?.seconds ?? 0);' in text)
print('invites_import_statement_count:', text.count('createTableAccessor'))
for field in ['createdAt', 'expiresAt']:
needle = f'sortingFn: (a, b) =>\n seconds(a.original.{field}) - seconds(b.original.{field})'
print(f'sortingFn_{field}:', f'"{field}" sorting uses seconds()' in needle)
# Find any nanoseconds references in the target file to establish whether nanos are already considered.
import re
print('nanos_mentions_in_target:', len(re.findall(r'\bnano[s]?\b', text, re.I)))
PYRepository: raystack/frontier
Length of output: 3203
🌐 Web query:
@bufbuild/protobuf Timestamp seconds nanos type
💡 Result:
In the @bufbuild/protobuf library (and the underlying Protocol Buffers standard), the google.protobuf.Timestamp message type is defined by two fields that work together to represent a point in time with nanosecond precision [1][2][3]: 1. seconds (int64): Represents the number of seconds of UTC time since the Unix epoch (1970-01-01T00:00:00Z) [2][3]. It must be between -62,135,596,800 and 253,402,300,799 (inclusive), corresponding to dates from 0001-01-01 to 9999-12-31 [2][3][4]. 2. nanos (int32): Represents non-negative fractions of a second in nanosecond resolution [2][3]. This value must be between 0 and 999,999,999 inclusive [2][3][4]. Even when representing negative time (seconds before the epoch), the nanos field must remain non-negative, as it acts as a forward-counting fraction of the specified second [2][3]. Technical usage notes: - Implementation: In @bufbuild/protobuf, Timestamp is considered a "well-known type" [1]. Because this type is standardized, its JSON representation is a string formatted according to RFC 3339 (e.g., "2026-08-07T12:00:00Z") [3][4]. - Library Access: In recent versions of @bufbuild/protobuf (v2.0+), you can access Timestamp-related utilities by importing from @bufbuild/protobuf/wkt (Well-Known Types) rather than the main package entry point [1][5]. - Conversion: The library provides helper functions such as timestampNow, timestampFromDate, timestampFromMs, and their counterparts (timestampDate, timestampMs) to facilitate conversion between Timestamp objects and native JavaScript/TypeScript Date objects [1].
Citations:
- 1: https://protobufes.com/reference/well-known-types/
- 2: https://buf.build/protocolbuffers/wellknowntypes/file/main:google/protobuf/timestamp.proto
- 3: https://buf.build/protocolbuffers/wellknowntypes/raw/v29.1/-/google/protobuf/timestamp.proto
- 4: https://github.com/google/protobuf/blob/main/src/google/protobuf/timestamp.proto
- 5: Missing
Timestamptyping for TS bufbuild/protobuf-es#951
Preserve nanosecond precision when sorting createdAt and expiresAt.
seconds() maps any timestamps in the same second to the same value, so the sortable columns can treat distinct invitations as equal. Compare seconds first and nanos second for createdAt and expiresAt.
Coverage Report for CI Build 31176527885Coverage remained the same at 47.99%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
Changes
Technical Details
Test Plan
SQL Safety (if your PR touches
*_repository.goorgoqu.*)?placeholders,goqu.Ex{}, orgoqu.Record{}— neverfmt.Sprintfor+building a query that gets executed.ToSQL()callers capture and forward params (query, params, err := stmt.ToSQL(); db.…Context(ctx, …, query, params...)). Neverquery, _, err := ….?placeholders inside single-quoted SQL literals ingoqu.L(usemake_interval(hours => ?)-style functions instead).//nolint:forbidigoor// #nosec G20xannotation has a one-line justification on the same line that a reviewer can verify.