Skip to content

refactor(api): migrate ThreadedComments from Flow to TypeScript - #4988

Open
bonchevskyi wants to merge 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-api-threaded-comments
Open

bonchevskyi wants to merge 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-api-threaded-comments

Conversation

@bonchevskyi

@bonchevskyi bonchevskyi commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Convert ThreadedComments API to TypeScript

This PR converts src/api/ThreadedComments from JavaScript with Flow to TypeScript.

Changes

  • Converted ThreadedComments.js to ThreadedComments.ts
  • Converted __tests__/ThreadedComments.test.js to ThreadedComments.test.ts (typed the constructor options as APIOptions)
  • Created ThreadedComments.js.flow with the original Flow source for backward compatibility with Flow consumers (APIFactory, Feed, useRepliesAPI)

Contract

  • Declared Flow contract preserved (method signatures, parameter requiredness, callback types, default export, runtime behavior)

Summary by CodeRabbit

  • New Features
    • Added support for threaded comments, including creating, editing, deleting, and retrieving comments and replies.
    • Comment listings can include reply counts and support pagination.

@bonchevskyi
bonchevskyi requested a review from a team as a code owner November 30, 2026 13:44
@mergify

mergify Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds a ThreadedComments API class with methods to create, update, delete, and retrieve comments and replies. The methods build request URLs, check permissions, pass request options, and format successful responses.

Changes

Threaded comments API

Layer / File(s) Summary
API setup and response formatting
src/api/ThreadedComments.ts, src/api/__tests__/ThreadedComments.test.ts
Adds the API subclass, URL builders, and response formatting. The test setup casts constructor options to APIOptions.
Comment and reply mutations
src/api/ThreadedComments.ts
Adds permission-checked methods to create, update, and delete comments, and to create replies.
Comment and reply retrieval
src/api/ThreadedComments.ts
Adds permission-checked methods to fetch a comment, list comments with pagination options, and fetch replies.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: vitali-usik, tjiang-box, jfox-box

Merge Risk: Minimal · up to c9a18

This change converts the threaded comments API to TypeScript and keeps a Flow declaration file for existing Flow consumers. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the refactor ("migrate ThreadedComments from Flow to TypeScript") and the scope (api). The changeset converts ThreadedComments.js to ThreadedComments.ts, renames its test to TypeScript…
Description check Passed The description follows the required structure in its own way. It gives a summary heading, a Changes list, and a Contract section. The repository template is a merge-queue checklist with no fields to …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the refactor ("migrate ThreadedComments from Flow to TypeScript") and the scope (api). The changeset converts ThreadedComments.js to ThreadedComments.ts, renames its test to TypeScript, and adds a Flow declaration file. The title covers the main change, so it passes.

Full details: Description check

Explanation

The description follows the required structure in its own way. It gives a summary heading, a Changes list, and a Contract section. The repository template is a merge-queue checklist with no fields to fill in. The description states the conversion, the renamed test, and the added Flow file. It does not state how the changes were verified, such as which tests ran. That gap is minor, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the comment trail,
Then sends a note along the way.
Replies gather, threads take shape,
Rich text joins the message flow.
The rabbit hops contentedly.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 125f226b-d497-4d6e-9362-ce7933483c2e
Commits

Reviewing files that changed from the base of the PR and between fcd5d5b and c9a185b.

Files selected for processing: 3

  • src/api/ThreadedComments.js.flow
  • src/api/ThreadedComments.ts
  • src/api/__tests__/ThreadedComments.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

This branch has not been deployed

No deployments
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