feat(auth)!: remove the deprecated AuthCheck and ClaimsCheck components - #782
Draft
tyler-reitz wants to merge 2 commits into
Draft
feat(auth)!: remove the deprecated AuthCheck and ClaimsCheck components#782tyler-reitz wants to merge 2 commits into
tyler-reitz wants to merge 2 commits into
Conversation
Both were deprecated in FirebaseExtended#368 (2021-05-14), which shipped useSigninCheck as their replacement in the same commit and migrated docs/use.md and the example app off them. Nothing in the repo has pointed at them since. That is four years and three months of deprecation. They only functioned with suspense enabled. In non-suspense mode they logged a warning and rendered anyway, so a suspense-mode user got no runtime signal at all, which is an argument for a clear upgrade-guide entry rather than for keeping them. Removing them is a runtime break for a plain JS importer, not just a type error, so it rides the major. Also removes the exported AuthCheckProps and ClaimsCheckProps. ClaimCheckErrors stays: it sits between them in the file but belongs to the SigninCheckResult shape that useSigninCheck returns. src/auth.tsx drops its `React` and `useSuspenseEnabledFromConfigAndContext` imports, which are used only by the removed code and would fail the build under noUnusedLocals. The file keeps its .tsx extension despite no longer containing JSX; renaming emits the same auth.js and only costs blame history. Tests: the four AuthCheck tests go. Two others used the AuthCheck wrapper without being about AuthCheck, so they get a useSigninCheck-based gate that renders the same testids. One of those was vacuous and is now real. `beforeEach` signs out, so the old gate rendered its fallback, UserDetails never mounted, and its two expectations never executed. It now signs in first and awaits the gated testid. Mutation-verified: removing the sign-in fails it. Group 3 of FirebaseExtended#754. Groups 1 and 2 are unaffected, so FirebaseExtended#754 stays open.
`console.info` is mocked in `beforeAll` to silence the Auth Emulator warning. The restore lived in an `afterAll` nested inside another `afterAll`, so the inner hook was only registered while teardown was already running, and never ran. The mock leaked past the suite. Pre-existing and unrelated to the AuthCheck removal, folded in because it is two lines in a file this branch already edits. The `@ts-expect-error` above it is still required, which the test typecheck confirms.
tyler-reitz
marked this pull request as draft
August 6, 2026 18:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Group 3 of #754. Refs #754, which stays open for Groups 1 and 2.
What this removes
AuthCheckandClaimsCheck, plus their exportedAuthCheckPropsandClaimsCheckPropstypes.They were deprecated in #368 on 2021-05-14, which shipped
useSigninCheckas the replacement in the same commit and migrateddocs/use.mdandexample/withoutSuspense/Auth.tsxoff them. Four years and three months. Nothing in the repo has pointed at them since.They also only ever worked with
<FirebaseAppProvider suspense={true}>. In non-suspense mode they logged a deprecation warning and rendered anyway, which means a suspense-mode user has had no runtime signal at all. That is an argument for a clear upgrade-guide entry rather than for keeping them, and there is one in this PR.Removing them is a runtime break for a plain JS importer (an import error at load), not just a type error, which is why this rides the major rather than a minor.
Deliberately kept
ClaimCheckErrorsstays. It sits directly between the two removed interfaces insrc/auth.tsxand is easy to take by accident, but it belongs to theSigninCheckResultshape thatuseSigninCheckreturns. It also sits between the two removed entries in the generated reference index, which is why the docs were regenerated rather than hand-edited.useIdTokenResultstays too. Its only in-repo caller wasClaimsCheck, but it is public API in its own right.Two consequences worth reading
1.
src/auth.tsxloses two imports, and a naive removal would not build.tsconfig.jsonsetsnoUnusedLocals, and everyReact.reference in the file (React.ReactNode×4 in the removed props,React.ReactElementinAuthCheck) plus every use ofuseSuspenseEnabledFromConfigAndContextlived inside the removed code. Both imports go. The file now contains no JSX; I kept the.tsxextension anyway, since renaming emits the sameauth.jsand only costs blame history.2. One of the tests I had to touch was vacuous, and it is now real.
it('always returns a user if inside an <AuthCheck> component')was not aboutAuthCheckat all, so it needed rewriting rather than deleting. While rewriting it:beforeEachsigns out, so the gate rendered its fallback,UserDetailsnever mounted, and both of itsexpectcalls never executed. The test's own comment said as much.It now signs in first and awaits the gated testid, so it fails if the gate never renders. Mutation-verified: removing the
signIn()makes it fail. This is the third inert-check of this shape found in this repo, after theentry-loadcanary list and the@ts-expect-errorin the options type test.Verification
tsc -p tsconfig.jsontsc -p tsconfig.test.jsonnpm run test:authAuthChecktests and 1test.todoare gone)npm run docs:forkThe reference docs show 9 more modified files than the deletions alone. Every one is a source-link line number moving because
src/auth.tsxlost 89 lines (src/auth.tsx:22becomes:20). No content changed in any of them.Test changes, in detail
describe('AuthCheck')block goes: 4 tests plus atest.todo, all of which existed only to exercise the removed component.AuthCheckWrapperwithout being aboutAuthCheck. They now share aSigninGateWrapperbuilt onuseSigninCheckthat renders the samesigned-in/signed-outtestids and keeps the suspense mode andSuspenseboundary the old wrapper had, sodoes not show a logged-out user after navigating awaystill tests what it tested.Noted, not fixed
The auth tests are coupled through the global observable cache. Under the mutation above, a second unrelated test also failed (
returns the same value as getAuth(app).currentUser), because theauth:user:cache entry persists across tests. Everything is green normally, and this is pre-existing rather than introduced here, but it is the sameglobalThiscache that per-request SSR scoping has to address, so it is worth knowing about before someone reorders these tests.One unrelated fix, folded in deliberately (second commit)
test/auth.test.tsxhad anafterAllnested inside anafterAll, so the innerconsole.info.mockRestore()was only registered once teardown was already running and never ran. The mock leaked past the suite.Pre-existing and nothing to do with
AuthCheck. It is two lines in a file this branch already edits, and it is a separate commit so it can be read or reverted on its own. The@ts-expect-errorabove it is still required, which the test typecheck confirms.Not in this PR
Groups 1 and 2 of #754. Group 1 (
checkOptions,checkinitialData) is blocked:checkIdFieldstill callscheckOptionsonv5, and the rewrite that removes it lives on #740's branch, which targetsmainand has not merged. Group 2 (startWithValue) is a behavior change with three live call sites and wants its own PR. #754 cannot close until Group 1 unblocks.