Repository navigation
Fix k8s-pods blank render and document scaffold pitfalls - #11
Merged
Merged
Conversation
Co-authored-by: setnilson <110850377+setnilson@users.noreply.github.com>
Co-authored-by: setnilson <110850377+setnilson@users.noreply.github.com>
|
Bits Code status: ✅ Done Comment @datadog-staging to request changes |
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.
Summary
Fixes the blank render of the
k8s-podsapp and documents the scaffolding pitfalls that caused it, so the next generated app avoids them.Root causes found:
^18 || ^19peer range of@datadog/apps-frontendto a nestedreact@19.3.0copy for the app (npm does not apply plain root overrides to peer resolutions), producing two React instances in the bundle. The app crashed on mount withCannot read properties of null (reading 'useEffect')/ReactCurrentDispatchererrors and rendered blank.DD_SITE/DATADOG_SITEenv value is rejected by the Datadog Vite plugin itself, breakingdev/buildin environments where the variable is set but empty.package.jsonscripts callnpx datadog-apps …, a CLI that does not resolve in this workspace.Per the follow-up request, the app now runs on mock data for demo purposes (verified working in a browser: table, namespace filter, delete action).
Changes
apps/k8s-pods/src/App.tsx: replaced the backend-driven listing with a mock pod list (demo); delete now removes the pod locally. Backend fileslistPods.backend.ts/deletePod.backend.tsremoved since unused;@tanstack/react-querydropped from the app's dependencies.package.json: added a scoped override (@datadog/apps-frontend → react/react-dom: $react) so the peer resolves to the single workspace React 18.3.1; regenerated lockfile no longer contains a nestedapps/k8s-pods/node_modules/reactcopy.apps/k8s-pods/vite.config.ts:resolve.dedupeforreact/react-domand a guard that unsets empty-stringDATADOG_SITE/DD_SITEenv values before plugin construction; also added the root-manifest site fallback matching the other apps.docs/agents/scaffolding.md(new): documented all scaffold pitfalls with fixes — unresolvabledatadog-appsCLI scripts, React version alignment with root overrides, the npm peer-driven React duplication and its override + dedupe fix, and the emptyDD_SITEguard. Linked from the rootAGENTS.md"Adding another app" section.origin/master.Testing
npm run dev: the app renders the pods table with mock data, the namespace filter works, and Delete removes an unhealthy pod with a confirmation message (screenshot attached). Console shows only benign DRUIDS strict-mode warnings after the fix; the React duplicate-instance errors are gone.npm run typecheck -w apps/k8s-podsandnpm run lint -w apps/k8s-podspass with zero warnings.npm run build -w apps/k8s-podspasses (withDD_SITEunset; the new env guard also handles the empty-string case in-process).origin/master, regeneratedpackage-lock.json(npm install --package-lock-only --ignore-scripts), validated withnpm ci --ignore-scripts; confirmed theapps/k8s-podsworkspace records exist and no nestedapps/k8s-pods/node_modules/reactentry remains.PR by Bits - View session in Datadog