Skip to content

fix(permissions): drop the membership request when stepping back - #3178

Merged
HarshMN2345 merged 1 commit into
mainfrom
fix-member-picker-back-error
Aug 21, 2026
Merged

fix(permissions): drop the membership request when stepping back#3178
HarshMN2345 merged 1 commit into
mainfrom
fix-member-picker-back-error

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

Follow-up to #3177, which merged before this Greptile P1 was addressed. The finding was correct.

The path: on step two with a membership request in flight, hit Back. clearUser() cleared the selected user but left the request live, and Back triggers no new request — so latestRequest never advanced and nothing invalidated it. On rejection the requestId !== latestRequest guard still matched, so loadError was set while the picker sat on step one. Result: "Could not load users." over a user list that had loaded fine, with a Retry wired to the wrong request.

Fix: clearUser() now advances the request counter and clears the error and spinner it owns, so stepping back abandons the request rather than leaving it able to report. The rejection path also checks the selected user, matching the success path instead of relying on the counter alone — that asymmetry is what Greptile flagged.

check 0 errors, lint 0 errors, 265 unit tests, build clean.

Back only cleared the selected user; it left the membership request in
flight and did not advance the request counter, so nothing invalidated
it. On rejection the guard still matched, and the error landed on the
user step — reporting "Could not load users." over a user list that had
loaded fine, with a Retry that re-ran the wrong request.

Back now invalidates the in-flight request and clears the error and
spinner it owns. The rejection path also checks the selected user, so it
matches the success path rather than relying on the counter alone.
@appwrite

appwrite Bot commented Aug 21, 2026

Copy link
Copy Markdown

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Each function runs in its own isolated container with custom environment variables

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents an abandoned membership request from updating the permissions picker after the user returns to step one.

  • Invalidates the active membership request when clearing the selected user.
  • Clears membership loading and error state when stepping back.
  • Applies the selected-user identity guard consistently to successful and failed membership responses.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable regressions identified in the updated request lifecycle.

The request counter invalidates abandoned work, both response paths verify request and user identity, and the guarded cleanup prevents stale requests from clearing newer loading state.

Important Files Changed

Filename Overview
src/lib/components/permissions/member.svelte Correctly invalidates stale membership requests and prevents their success, failure, or cleanup paths from affecting the current picker state.

Reviews (1): Last reviewed commit: "fix(permissions): drop the membership re..." | Re-trigger Greptile

@HarshMN2345
HarshMN2345 merged commit 3ee4f75 into main Aug 21, 2026
4 checks passed
@HarshMN2345
HarshMN2345 deleted the fix-member-picker-back-error branch August 21, 2026 04:42
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.

2 participants