Skip to content

Conversation

@erikras
Copy link
Member

@erikras erikras commented Jun 4, 2025

No description provided.

@erikras erikras requested a review from Copilot June 4, 2025 07:29

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

@erikras erikras requested a review from Copilot June 4, 2025 08:15
@erikras erikras merged commit 35df2d9 into master Jun 4, 2025
3 checks passed
@erikras erikras deleted the ts branch June 4, 2025 08:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the codebase from Flow/JavaScript to TypeScript, updates build tooling, and refreshes dependencies and CI/workflow configs.

  • Rewrite OnChange, OnBlur, and ExternallyChanged components and tests in TypeScript
  • Switch Rollup from Flow plugin to rollup-plugin-typescript2 and update Babel presets
  • Upgrade dependencies in package.json and adjust CI/app scripts for linting and typechecking

Reviewed Changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/OnChange.tsx Converted listener component to TS/TSX with hooks
src/OnBlur.tsx Migrated blur listener component to TypeScript
src/ExternallyChanged.tsx Migrated external-change tracker component to TS/TSX
rollup.config.js Swapped Flow plugin for TypeScript, updated input
package.json Added "types", bumped dev dependencies, TS/Jest
.github/workflows/ci.yml CI configuration added (lint, prettier, test, coverage)

// is designed to run on every render. It compares the current and previous
// values of `input.value` and triggers the `children` callback if they differ.
React.useLayoutEffect(() => {
if (!hasInitializedRef.current) {
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your tests expect the listener to be called on first render, but this branch skips calling children. You should invoke children(input.value, previousValueRef.current) during initial setup or update the tests to align with intended behavior.

Suggested change
if (!hasInitializedRef.current) {
if (!hasInitializedRef.current) {
children(input.value, previousValueRef.current)

Copilot uses AI. Check for mistakes.
children(input.value, previousValueRef.current)
previousValueRef.current = input.value
}
})
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This useLayoutEffect intentionally omits its dependency array, but will trigger a lint warning. Consider adding // eslint-disable-next-line react-hooks/exhaustive-deps or specifying dependencies explicitly for clarity.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +15

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: "22"
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifying Node.js version "22" may fail since it's not a published LTS. Either define a strategy.matrix.node_version with supported versions (e.g., 18, 20) or use an existing LTS like "18".

Suggested change
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: "22"
strategy:
matrix:
node_version: [18, 20]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants