Skip to content

Feature Request: Simplify createReconciler #33137

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

Open
ahaoboy opened this issue May 7, 2025 · 0 comments
Open

Feature Request: Simplify createReconciler #33137

ahaoboy opened this issue May 7, 2025 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@ahaoboy
Copy link

ahaoboy commented May 7, 2025

React version:

    "react": "19.1.0",
    "react-dom": "19.1.0",
    "react-reconciler": "0.32.0",

    "@types/react": "19.1.3",
    "@types/react-dom": "19.1.3",
    "@types/react-reconciler": "0.32.0",

Steps To Reproduce

The parameters of the createReconciler function are too complex. Is it possible to provide default values?

Using vscode to autocomplete the createReconciler function, it's very complicated

createReconciler({
  supportsMutation: false,
  supportsPersistence: false,
  createInstance: function (type: unknown, props: unknown, rootContainer: unknown, hostContext: unknown, internalHandle: createReconciler.OpaqueHandle): unknown {
    throw new Error("Function not implemented.")
  },
  createTextInstance: function (text: string, rootContainer: unknown, hostContext: unknown, internalHandle: createReconciler.OpaqueHandle): unknown {
    throw new Error("Function not implemented.")
  },
  appendInitialChild: function (parentInstance: unknown, child: unknown): void {
    throw new Error("Function not implemented.")
  },
  finalizeInitialChildren: function (instance: unknown, type: unknown, props: unknown, rootContainer: unknown, hostContext: unknown): boolean {
    throw new Error("Function not implemented.")
  },
  shouldSetTextContent: function (type: unknown, props: unknown): boolean {
    throw new Error("Function not implemented.")
  },
  getRootHostContext: function (rootContainer: unknown): unknown {
    throw new Error("Function not implemented.")
  },
  getChildHostContext: function (parentHostContext: unknown, type: unknown, rootContainer: unknown): unknown {
    throw new Error("Function not implemented.")
  },
  getPublicInstance: function (instance: unknown): unknown {
    throw new Error("Function not implemented.")
  },
  prepareForCommit: function (containerInfo: unknown): Record<string, any> | null {
    throw new Error("Function not implemented.")
  },
  resetAfterCommit: function (containerInfo: unknown): void {
    throw new Error("Function not implemented.")
  },
  preparePortalMount: function (containerInfo: unknown): void {
    throw new Error("Function not implemented.")
  },
  scheduleTimeout: function (fn: (...args: unknown[]) => unknown, delay?: number): unknown {
    throw new Error("Function not implemented.")
  },
  cancelTimeout: function (id: unknown): void {
    throw new Error("Function not implemented.")
  },
  noTimeout: undefined,
  isPrimaryRenderer: false,
  getInstanceFromNode: function (node: any): createReconciler.Fiber | null | undefined {
    throw new Error("Function not implemented.")
  },
  beforeActiveInstanceBlur: function (): void {
    throw new Error("Function not implemented.")
  },
  afterActiveInstanceBlur: function (): void {
    throw new Error("Function not implemented.")
  },
  prepareScopeUpdate: function (scopeInstance: any, instance: any): void {
    throw new Error("Function not implemented.")
  },
  getInstanceFromScope: function (scopeInstance: any): unknown {
    throw new Error("Function not implemented.")
  },
  detachDeletedInstance: function (node: unknown): void {
    throw new Error("Function not implemented.")
  },
  supportsHydration: false,
  NotPendingTransition: undefined,
  HostTransitionContext: undefined,
  setCurrentUpdatePriority: function (newPriority: createReconciler.EventPriority): void {
    throw new Error("Function not implemented.")
  },
  getCurrentUpdatePriority: function (): createReconciler.EventPriority {
    throw new Error("Function not implemented.")
  },
  resolveUpdatePriority: function (): createReconciler.EventPriority {
    throw new Error("Function not implemented.")
  },
  resetFormInstance: function (form: unknown): void {
    throw new Error("Function not implemented.")
  },
  requestPostPaintCallback: function (callback: (time: number) => void): void {
    throw new Error("Function not implemented.")
  },
  shouldAttemptEagerTransition: function (): boolean {
    throw new Error("Function not implemented.")
  },
  trackSchedulerEvent: function (): void {
    throw new Error("Function not implemented.")
  },
  resolveEventType: function (): null | string {
    throw new Error("Function not implemented.")
  },
  resolveEventTimeStamp: function (): number {
    throw new Error("Function not implemented.")
  },
  maySuspendCommit: function (type: unknown, props: unknown): boolean {
    throw new Error("Function not implemented.")
  },
  preloadInstance: function (type: unknown, props: unknown): boolean {
    throw new Error("Function not implemented.")
  },
  startSuspendingCommit: function (): void {
    throw new Error("Function not implemented.")
  },
  suspendInstance: function (type: unknown, props: unknown): void {
    throw new Error("Function not implemented.")
  },
  waitForCommitToBeReady: function (): ((initiateCommit: (...args: unknown[]) => unknown) => (...args: unknown[]) => unknown) | null {
    throw new Error("Function not implemented.")
  }
})

For example, HostTransitionContext, in "@types/react-reconciler": "0.31.0", I didn't pass in this parameter, and its default value seems to be

export const HostTransitionContext: ReactContext<TransitionStatus> = {
?

Can this parameter be optional for custom renderers that don't need animation?

"@types/react-reconciler": "0.32.0" requires the following functions compared to "@types/react-reconciler": "0.31.0"
I believe that in most cases you can use the default implementation or provide a default error function? When you really need to use custom functions, add your own custom functions


    NotPendingTransition: undefined,
    resetFormInstance: function (): void {
      throw new Error("Function not implemented.")
    },
    requestPostPaintCallback: function (): void {
      throw new Error("Function not implemented.")
    },
    shouldAttemptEagerTransition: function (): boolean {
      throw new Error("Function not implemented.")
    },
    trackSchedulerEvent: function (): void {
      throw new Error("Function not implemented.")
    },
    resolveEventType: function (): null | string {
      throw new Error("Function not implemented.")
    },
    resolveEventTimeStamp: function (): number {
      throw new Error("Function not implemented.")
    },
    preloadInstance: function (): boolean {
      throw new Error("Function not implemented.")
    },
    startSuspendingCommit: function (): void {
      throw new Error("Function not implemented.")
    },
    suspendInstance: function (): void {
      throw new Error("Function not implemented.")
    },
    waitForCommitToBeReady: function (): ((initiateCommit: (...args: unknown[]) => unknown) => (...args: unknown[]) => unknown) | null {
      throw new Error("Function not implemented.")
    },
    HostTransitionContext: undefined
@ahaoboy ahaoboy added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant