Fix code-review correctness + test/config findings - #71
Open
cyongverto wants to merge 1 commit into
Open
Conversation
- different-size demo (OnPush): mark the view dirty when a router query-param emission mutates `size`, so back/forward navigation re-renders the widget/select instead of showing a stale size. Also pipe the subscription through takeUntilDestroyed(). - value-accessor directive: declare `standalone: true` explicitly instead of relying on the Angular 22 default, so the forms-module `imports:` entry stays valid across the Angular 18+ peer range. - vitest: drop the dead workspace-root-relative include glob; vitest runs with the project dir as its root, so `src/**/*.spec.ts` is the glob that matches the library specs. - remove the misleading ngx-turnstile-demo `test` target (and its orphaned tsconfig.spec.json): it ran zero specs and shared the library's root vitest config, giving a false-green test target. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying ngx-turnstile with
|
| Latest commit: |
2e29833
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8d10ea99.ngx-turnstile.pages.dev |
| Branch Preview URL: | https://fix-review-correctness.ngx-turnstile.pages.dev |
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.
Stacked on #69 (
upgrade/angular-22). Addresses verified findings from the high-effort code review of the Angular 18→22 PR stack.Correctness
different-sizedemo — the component isChangeDetectionStrategy.OnPush, but the constructor'squeryParamMapsubscription mutatedsize(bound to[size]and[ngModel]) from an async router emission that never marked the view dirty. On browser back/forward the dropdown and widget showed a stale size. Now callsmarkForCheck()after updating, and pipes throughtakeUntilDestroyed().Test / config correctness
standalone: trueon the value-accessor directive — it was relying on the Angular 22 default while the forms module lists it inimports:. Made explicit so form integration stays valid across the advertised Angular 18+ peer floor.ngx-turnstile-demodeclared a@analogjs/vitest-angular:testtarget that shared the library's root vitest config and ran zero specs (a false-green target). Removed it along with its orphanedtsconfig.spec.json. CI already targets the library explicitly (ng test ngx-turnstile).src/**/*.spec.tsis the glob that actually matches the library specs (the review's original claim about which glob was dead was inverted; verified by running).Not addressed here
reset()emitsnullinto the form control on token expiry" finding was intentionally left as-is: clearing an expired Turnstile token from the bound control is correct security behavior — an expired CAPTCHA token must not remain submittable, and Cloudflare's defaultrefresh-expired: autore-issues a fresh token right after. See the discussion for rationale.target,.gitignore/eslint noise, cypress tsconfigextends, droppedng-reflect-languagee2e assertion) are out of scope for this correctness-focused PR.Verification
ng test ngx-turnstile --watch=false→ 2 files, 5 tests passng build ngx-turnstileandng build ngx-turnstile-demo→ build cleanng lint→ all files passprettier --checkon changed files → clean🤖 Generated with Claude Code