gateway ui: fix People.tsx type error that broke the v0.4.262 image build - #1696
Merged
Merged
Conversation
… build fix) The v0.4.262 image build failed in the plugin-ui-builder stage: src/pages/People.tsx(123,40): error TS2339: Property 'get' does not exist on type 'RevokeUsersResponse | Map<string, string>'. The useMemo in People.tsx relied on `if (!revoked.data) return revoked.data` narrowing the query result's `data` through the truthiness check. That narrowing held with the local node_modules but not in the image build (the UI lockfile is gitignored, so the image resolves dependencies fresh with `npm install`). Bind `revoked.data` to a local const, test `undefined` / `null` explicitly, and annotate the memo's return type so the result is `Map | null | undefined` under every TS / react-query resolution.
…tree The root .gitignore ignored package-lock.json repo-wide (the rest of the monorepo is yarn), which left the gateway admin SPA resolving its dependencies fresh on every image build: the Dockerfile's `npm ci` branch never ran, gateway-check.yml keyed its cache on package.json, and ui/AGENTS.md claimed a lockfile that wasn't there. That is how the v0.4.262 build could fail on code that type-checked locally. Un-ignore the SPA lockfile, commit it, key the CI cache on it, and make `make ui-install` (the CI target) `npm ci`. The Dockerfile already switches to `npm ci` when the file is present. Verified: `npm ci` from this lockfile plus `npm run build` in node:22-alpine on Linux.
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.
What
The v0.4.262 release build (publish-gateway.yml, run 35023442898, commit 588afcb) failed in the
plugin-ui-builderstage on code from #1694:Two commits:
The narrowing fix. The
useMemothat maps revoked users to their cutoff relied onif (!revoked.data) return revoked.datanarrowing the TanStack query result'sdatathrough a truthiness check. It now bindsrevoked.datato a local const, testsundefinedandnullexplicitly, and annotates the memo's return type, so the result isMap | null | undefinedregardless of howuseQuery's result type is resolved.Commit the SPA lockfile. The root
.gitignoreignoredpackage-lock.jsonrepo-wide (the rest of the monorepo is yarn), so the gateway SPA resolved its dependencies fresh on every image build: the Dockerfile'snpm cibranch never ran,gateway-check.ymlkeyed its cache onpackage.json, andui/AGENTS.mdclaimed a lockfile that wasn't there. This un-ignores and commits it, keys the CI cache on it, and makesmake ui-install(the CI target)npm ci. The Dockerfile already switches tonpm ciwhen the file is present. From here, local,gateway-check.yml, and the release image all install the identical tree.Reproduction status
I could not reproduce the failure outside the release job. The unfixed code type-checks clean with: the local
node_modules; a freshnpm installon macOS;node:22-alpineon Linux; and the exactnode:25-alpine3.23image onlinux/amd64(npm 11.12.1), which resolves the same react-query 5.102.8 / TS 5.6.3 / preact 10.29.8 the registry serves today (nothing in that set has been published since Aug 27). I don't have an explanation for why the release runner'snpm installproduced a different result. The two changes above are safe either way: the fix does not depend on the narrowing that differed, and the lockfile removes the fresh-resolution variable from future builds.Verified
npm run typecheckandnpm run buildclean in the repo.npm cifrom the committed lockfile plusnpm run buildinnode:22-alpineon Linux (platform-specific esbuild/rollup optional packages resolve).go/tygo untouched.