Skip to content

fix(ui): remove the unused, broken AnonymousAuth component - #1555

Merged
ishaanxgupta merged 1 commit into
supermemoryai:mainfrom
rajarshidattapy:fix/remove-broken-anonymous-auth
Aug 19, 2026
Merged

ishaanxgupta merged 1 commit into
supermemoryai:mainfrom
rajarshidattapy:fix/remove-broken-anonymous-auth

Conversation

@rajarshidattapy

Copy link
Copy Markdown
Contributor

Fixes #1542.

Why?

packages/ui/other/anonymous-auth.tsx treats every better-auth client call as if it returned raw data, but the client returns { data, error }. Every access reads undefined:

const session = await authClient.getSession()
if (!session?.session) { ... }              // always true  -> always "no session"

const res = await authClient.signIn.anonymous()
if (!res.token) throw new Error(...)        // always throws -> catch -> router.push(loginPath)

So the component has exactly one reachable behaviour: fall into the "no session" branch, throw on the missing token, and redirect to the login path. The org-listing branches (orgs?.length, orgs?.map, orgs?.[0], org.slug) are wrong the same way — authClient.organization.list() returns { data, error } too.

It also has no importers. Repo-wide, the identifier appears only in its own definition:

$ rg 'AnonymousAuth|anonymous-auth'
packages/ui/other/anonymous-auth.tsx:7:export const AnonymousAuth = ({

Unreferenced dead code, but it was still failing check-types for every package that depends on @repo/ui. All 23 of the package's type errors were in this one file.

What?

Delete it.

Repairing it instead would be speculative — nothing calls it, so there is no behaviour to preserve and no way to tell whether a rewrite matches anyone's expectations. Git history has the file if anonymous sign-in comes back, and it would need rewriting against the { data, error } contract regardless.

packages/ui is "private": true and workspace-only, so removing a file is not a published API change. other/glass-effect.tsx is untouched.

Testing

packages/ui goes from 23 errors to 0:

$ cd packages/ui && bunx tsc --noEmit
# before: 23 errors, all in other/anonymous-auth.tsx
# after:  clean

Because check-types is dependsOn: ["^check-types"], @repo/ui was also blocking its dependents. Root turbo run check-types:

before:  Tasks: 6 successful, 11 total   Failed: @repo/ui#check-types
after:   Tasks: 8 successful, 11 total   Failed: @supermemory/tools#check-types

Two more packages now get to run. The remaining failure is pre-existing and unrelated — see #1545 (and #1544 for @repo/web), both of which this PR deliberately leaves alone.

AnonymousAuth treated every better-auth client call as if it returned raw
data, but the client returns { data, error }. Every access read undefined,
so the component could only ever do one thing: fall into the "no session"
branch, throw on the missing token, and redirect to the login path. The
org-listing branches were wrong the same way.

It has no importers anywhere in the repo -- it is unreferenced dead code
that was nonetheless failing check-types for every package that depends
on @repo/ui. All 23 of the package's type errors were in this one file.

Deleting rather than repairing: nothing calls it, so a rewrite would be
speculative. Git history has the file if anonymous sign-in comes back,
and it would need writing against the { data, error } contract regardless.

packages/ui is private and workspace-only, so removing the file is not a
published API change.
@ishaanxgupta
ishaanxgupta merged commit 20410a6 into supermemoryai:main Aug 19, 2026
6 checks passed
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.

AnonymousAuth is dead code that is broken at runtime and fails check-types

2 participants