-
Notifications
You must be signed in to change notification settings - Fork 226
Upgrade Ink to v6 and React to v19 #6831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
28e81f7 to
a3819fe
Compare
03b74ca to
322430f
Compare
Ink 6 requires React 19 as a peer dependency. This upgrades both libraries and fixes the breaking changes: - Remove forwardRef pattern in SelectInput (ref is now a regular prop) - Update RefObject type for React 19 compatibility - Remove custom forwardRef module augmentation Co-Authored-By: Claude Opus 4.6 <[email protected]>
322430f to
aedbd23
Compare
Coverage report
Test suite run success3718 tests passing in 1438 suites. Report generated by 🧪jest coverage report action from aedbd23 |
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/testing/ui.d.ts@@ -73,7 +73,8 @@ export declare function sendInputAndWait(renderInstance: ReturnType<typeof rende
export declare function sendInputAndWaitForContent(renderInstance: ReturnType<typeof render>, content: string, ...inputs: string[]): Promise<void>;
/** Function that is useful when you want to check the last frame of a component that unmounted.
*
- * The reason this function exists is that in CI Ink will clear the last frame on unmount.
+ * With Ink 6 / React 19, the output is no longer cleared on unmount,
+ * so lastFrame() consistently returns the last rendered content.
*/
export declare function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>): string | undefined;
type TrackedPromise<T> = Promise<T> & {
packages/cli-kit/dist/private/node/ui/components/SelectInput.d.ts@@ -1,8 +1,5 @@
import React from 'react';
import { DOMElement } from 'ink';
-declare module 'react' {
- function forwardRef<T, P>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
-}
export interface SelectInputProps<T> {
items: Item<T>[];
initialItems?: Item<T>[];
@@ -18,7 +15,8 @@ export interface SelectInputProps<T> {
morePagesMessage?: string;
availableLines?: number;
onSubmit?: (item: Item<T>) => void;
- inputFixedAreaRef?: React.RefObject<DOMElement>;
+ inputFixedAreaRef?: React.Ref<DOMElement>;
+ ref?: React.Ref<DOMElement>;
groupOrder?: string[];
}
export interface Item<T> {
@@ -29,4 +27,5 @@ export interface Item<T> {
helperText?: string;
disabled?: boolean;
}
-export declare const SelectInput: <T>(props: SelectInputProps<T> & React.RefAttributes<DOMElement>) => React.ReactElement | null;
\ No newline at end of file
+declare function SelectInput<T>({ items: rawItems, initialItems, onChange, enableShortcuts, focus, emptyMessage, defaultValue, highlightedTerm, loading, errorMessage, hasMorePages, morePagesMessage, availableLines, onSubmit, inputFixedAreaRef, ref, groupOrder, }: SelectInputProps<T>): React.ReactElement | null;
+export { SelectInput };
\ No newline at end of file
|
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by installing your package globally: npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]Caution After installing, validate the version by running just |
|
@gonzaloriestra Thank you for generating the snapshot build. What are the next steps for me? I tested the snapshot with the |
|
You don't need to do anything else. I just need some time to review and test it a bit. Thanks a lot for taking care of this! |
WHY are these changes introduced?
Ink v6 was released with React 19 as a peer dependency. Upgrading keeps the CLI on the latest supported versions of both libraries, benefiting from React 19 performance improvements and Ink 6 fixes.
WHAT is this pull request doing?
Dependency bumps:
ink: 5.2.1 → 6.2.0 (cli-kit)react: ^18.2.0 → ^19.0.0 (cli-kit,app)@types/react: ^18.2.0 → ^19.0.0 (cli-kit,app)react-dom: 18.3.1 → ^19.0.0 (app)@types/react-dom: ^18.2.0 → ^19.0.0 (app)Code changes (all in
SelectInput.tsx):forwardRefwrapper and custom module augmentation —refis now a regular prop in React 19inputFixedAreaReftype fromReact.RefObject<DOMElement>toReact.Ref<DOMElement>for React 19 compatibilityNo other code changes were required. The codebase was already clean of deprecated React 18 patterns (no
defaultProps,propTypes, string refs, legacy context, or implicitchildrenonFunctionComponent).How to test your changes?
pnpm installpnpm --filter @shopify/cli-kit type-check— passespnpm --filter @shopify/app type-check— passesMeasuring impact
Checklist
🤖 Generated with Claude Code