mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
a029ee63cb
Two follow-ups to the CatalogPurchaseWidgetView fix (6bf3366):
1. CatalogItemGridWidgetView had the same shape — four useCallback
declarations (handleDragStart / handleDragOver / handleDrop /
handleDragEnd) sat below an `if(!currentPage) return null` early
return. When currentPage flipped from null to a real page the hook
count jumped by 4 and React would have thrown "Rendered more hooks
than during the previous render" the moment any consumer rendered
the grid in admin mode. Moved the four useCallback declarations
above the early-return; their bodies are safe pre-load (only
currentPage?.offers is accessed inside handleDrop, optional-chained
already).
2. CI gate — the existing GitHub Actions workflow runs `yarn
typecheck` and `yarn test`, but NOT `yarn eslint`. That's why this
pattern slipped through twice in a row: ESLint flags it locally
but no PR check enforces it. Full `yarn eslint` emits ~900
pre-existing baseline errors (brace-style, indentation,
recommended TS rules — out of scope for this branch), so a blanket
step would always fail. Instead added a focused
`eslint.hooks.config.mjs` + `yarn lint:hooks` script that runs
ESLint with ONLY `react-hooks/rules-of-hooks: error`. Wired into
ci.yml between `typecheck` and `test`. The local repo now has
zero violations of the rule.
3. useSessionSnapshots.test.tsx — added eslint-disable-next-line
comments on the three lines that intentionally violate the rule
(they're the assertions that the broken pattern crashes). Without
the comments the new CI gate would fail on the regression-guard
suite.
Verification: yarn lint:hooks green, yarn typecheck clean, yarn test
209/209.
97 lines
3.6 KiB
YAML
97 lines
3.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'feat/**'
|
|
pull_request:
|
|
|
|
# Opt into the Node.js 24 runtime for the JavaScript actions
|
|
# (actions/checkout, actions/setup-node, …). Node 20 will be removed
|
|
# from GitHub-hosted runners in September 2026; this env var asks the
|
|
# runner to use Node 24 today so the workflow logs stop warning about
|
|
# it on every run.
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
|
|
|
|
jobs:
|
|
check:
|
|
name: Type check + tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# The build/dev/typecheck setup expects the Nitro renderer SDK to
|
|
# live as a sibling of this repo (see CLAUDE.md → Setup walkthrough).
|
|
# Mirror that here by checking the client into <workspace>/Nitro-V3
|
|
# and the renderer into <workspace>/Nitro_Render_V3.
|
|
- name: Checkout Nitro-V3
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: Nitro-V3
|
|
|
|
# The client tracks renderer changes that are pushed to the
|
|
# `feat/react19-event-bus` branch of `simoleo89/Nitro_Render_V3`
|
|
# (allowUnderpass + sendBackgroundMessage + Window NitroConfig
|
|
# alignment, etc.). `duckietm/Nitro_Render_V3:main` doesn't yet
|
|
# have those, so tsgo would fail right away if we checked that
|
|
# out instead.
|
|
- name: Checkout Nitro_Render_V3 (sibling)
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: simoleo89/Nitro_Render_V3
|
|
ref: feat/react19-event-bus
|
|
path: Nitro_Render_V3
|
|
|
|
- name: Setup Node 22
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: yarn
|
|
cache-dependency-path: |
|
|
Nitro-V3/yarn.lock
|
|
Nitro_Render_V3/yarn.lock
|
|
|
|
- name: Install renderer SDK deps
|
|
working-directory: Nitro_Render_V3
|
|
run: yarn install --frozen-lockfile
|
|
|
|
- name: Install client deps
|
|
working-directory: Nitro-V3
|
|
run: yarn install --frozen-lockfile
|
|
|
|
# The renderer SDK is consumed via a filesystem symlink in
|
|
# node_modules/@nitrots/nitro-renderer; create it AFTER yarn
|
|
# install (otherwise yarn would clean it up since the package
|
|
# isn't declared in package.json). tsgo (TS 7 native preview)
|
|
# then resolves the tsconfig `include` entry pointing at the
|
|
# renderer's `src/**/*.ts`.
|
|
#
|
|
# Use an absolute path so the link target is unambiguous
|
|
# regardless of the cwd that reads it. A relative target like
|
|
# `../../../Nitro_Render_V3` resolves to
|
|
# `Nitro-V3/Nitro_Render_V3` (one too few `..`), which doesn't
|
|
# exist and makes tsgo report TS2307 across the entire src/.
|
|
- name: Symlink renderer into client node_modules
|
|
run: |
|
|
mkdir -p Nitro-V3/node_modules/@nitrots
|
|
ln -sfn "${{ github.workspace }}/Nitro_Render_V3" Nitro-V3/node_modules/@nitrots/nitro-renderer
|
|
ls -la Nitro-V3/node_modules/@nitrots/
|
|
ls Nitro-V3/node_modules/@nitrots/nitro-renderer/packages/api/src/ | head -5
|
|
|
|
- name: Type check (tsgo)
|
|
working-directory: Nitro-V3
|
|
run: yarn typecheck
|
|
|
|
# Hook-order lint gate — the full yarn eslint emits ~900 pre-existing
|
|
# baseline errors (brace style, indentation), so we use a focused
|
|
# config that asserts only react-hooks/rules-of-hooks. Catches the
|
|
# "hook below early-return" pattern that produced two production
|
|
# crashes this session (CatalogPurchaseWidgetView, CatalogItemGridWidgetView).
|
|
- name: ESLint (hook-order gate)
|
|
working-directory: Nitro-V3
|
|
run: yarn lint:hooks
|
|
|
|
- name: Vitest
|
|
working-directory: Nitro-V3
|
|
run: yarn test --run
|