Skip to content
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

add thread reply list pagination #343

Merged
merged 1 commit into from
Jan 2, 2025
Merged

Conversation

Southclaws
Copy link
Owner

@Southclaws Southclaws commented Jan 2, 2025

image

Copy link

vercel bot commented Jan 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
storyden ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 8:51pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
storyden-homepage ⬜️ Ignored (Inspect) Visit Preview Jan 2, 2025 8:51pm

Copy link

coderabbitai bot commented Jan 2, 2025

Warning

Rate limit exceeded

@Southclaws has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between cadb52e and 2c87659.

⛔ Files ignored due to path filters (1)
  • api/openapi.yaml is excluded by !**/*.yaml
📒 Files selected for processing (29)
  • app/resources/datagraph/hydrate/hydrator.go (2 hunks)
  • app/resources/post/thread/db.go (5 hunks)
  • app/resources/post/thread/repo.go (2 hunks)
  • app/resources/post/thread/thread.go (2 hunks)
  • app/resources/seed/post.go (5 hunks)
  • app/services/thread/delete.go (2 hunks)
  • app/services/thread/get.go (2 hunks)
  • app/services/thread/service.go (2 hunks)
  • app/services/thread/thread_semdex/indexer.go (1 hunks)
  • app/services/thread/update.go (2 hunks)
  • app/transports/http/bindings/threads.go (1 hunks)
  • app/transports/http/bindings/utils.go (1 hunks)
  • app/transports/http/openapi/server_gen.go (14 hunks)
  • tests/collection/items_test.go (3 hunks)
  • tests/like/like_test.go (2 hunks)
  • tests/thread/reaction/reaction_test.go (5 hunks)
  • tests/thread/thread_test.go (4 hunks)
  • web/src/api/openapi-client/threads.ts (4 hunks)
  • web/src/api/openapi-schema/index.ts (2 hunks)
  • web/src/api/openapi-schema/paginatedReplyList.ts (1 hunks)
  • web/src/api/openapi-schema/paginatedReplyListAllOf.ts (1 hunks)
  • web/src/api/openapi-schema/threadAllOf.ts (1 hunks)
  • web/src/api/openapi-schema/threadGetParams.ts (1 hunks)
  • web/src/api/openapi-server/threads.ts (2 hunks)
  • web/src/app/(dashboard)/t/[slug]/page.tsx (2 hunks)
  • web/src/components/thread/ReplyList/ReplyList.tsx (1 hunks)
  • web/src/lib/thread/mutation.ts (5 hunks)
  • web/src/screens/thread/ThreadScreen/ThreadScreen.tsx (3 hunks)
  • web/src/screens/thread/ThreadScreen/useThreadScreen.ts (3 hunks)
📝 Walkthrough

Walkthrough

This pull request introduces comprehensive pagination support for threads and replies across the entire application stack. The changes span multiple layers, including backend repositories, services, HTTP transports, and frontend components. The primary focus is on enhancing the thread and reply retrieval mechanism by adding pagination parameters, modifying data structures, and updating API interfaces to support paginated results.

Changes

File Path Change Summary
app/resources/datagraph/hydrate/hydrator.go Updated Hydrate method to include pagination parameters
app/resources/post/thread/db.go Added repliesCountQuery, modified Get method to support pagination
app/resources/post/thread/repo.go Updated Repository interface with pagination parameters
app/resources/post/thread/thread.go Changed Replies field type to pagination.Result
app/services/thread/* Modified service methods to include pagination parameters
app/transports/http/bindings/utils.go Added serialiseThreadRepliesPaginatedList function
web/src/api/openapi-* Created new TypeScript types for pagination support
web/src/screens/thread/ThreadScreen/* Updated components to handle pagination controls

Sequence Diagram

sequenceDiagram
    participant Client
    participant HTTPTransport
    participant ThreadService
    participant ThreadRepository
    participant Database

    Client->>HTTPTransport: Request thread with pagination params
    HTTPTransport->>ThreadService: Get thread (with page params)
    ThreadService->>ThreadRepository: Retrieve thread
    ThreadRepository->>Database: Query thread with pagination
    Database-->>ThreadRepository: Return paginated results
    ThreadRepository-->>ThreadService: Return thread with paginated replies
    ThreadService-->>HTTPTransport: Return thread data
    HTTPTransport-->>Client: Respond with paginated thread
Loading

Possibly related PRs

Poem

🐰 Pagination Rabbit's Delight

Threads and replies, now take flight
Pages dancing left and right
With parameters so neat and tight
Our data flows with pure delight!

  • Hoppy the Pagination Bunny 🥕

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (13)
app/transports/http/openapi/server_gen.go (4)

2030-2038: Ensure consistent usage of pagination fields.
The new PaginatedReplyList looks good for encapsulating pagination data. However, consider unifying this with PaginatedResult if there's overlap or if you want a single structure to manage pagination across different response types.


3798-3803: Parameter struct addition appears sensible.
ThreadGetParams clarifies what parameters ThreadGet can accept. If you plan to add more pagination attributes (like limit, offset, etc.), you could extend this struct for further flexibility.


6434-6435: Check for nil parameters before creating the request.
When params == nil, you safely skip pagination, but it might be worth adding a quick defensive check or a comment to clarify that scenario.


11423-11444: Consider specifying default pagination parameters.
This logic appends page if present. If none is provided, you might default to page 1 and page size N. Adding a clear default can improve user experience.

web/src/app/(dashboard)/t/[slug]/page.tsx (1)

1-1: Introduce error checking for query parameters

Your current QuerySchema transformation is straightforward for the page query. Consider verifying that the parsed integer is valid (e.g., not negative or zero). This might prevent potential edge cases when invalid query parameters are passed.

Example approach:

const QuerySchema = z.object({
  page: z
    .string()
    .transform((v) => {
      const parsed = parseInt(v, 10);
+     if (isNaN(parsed) || parsed < 1) {
+       return 1;
+     }
      return parsed;
    })
    .optional(),
});

Also applies to: 12-12, 15-20, 22-22, 26-28, 33-33

app/services/thread/get.go (1)

25-25: Ensure robust handling of pagination defaults
Consider validating or providing default values for pageParams when the caller omits certain fields (e.g., page size, page number). This helps avoid edge cases or unexpected behavior if defaults aren't specified in the calling logic.

web/src/screens/thread/ThreadScreen/useThreadScreen.ts (1)

42-45: Directly converting page number to string
This is a convenient approach for the SWR/HTTP client. Consider defensive checks if negative or zero values are passed. Also, ensure fallbackData properly reflects any default page data when initialPage is unset.

Also applies to: 47-51

app/resources/post/thread/thread.go (1)

34-34: Switch to pagination.Result for replies
This is a clean design choice that encapsulates pagination info along with the reply list. Ensure downstream code handles this new type correctly (e.g., accessing Replies.Replies vs. Replies).

web/src/api/openapi-server/threads.ts (1)

117-126: Thread retrieval function passing optional parameters.
This ensures that the provided params are used to accurately fetch paginated data. Double-check that default values or undefined parameters do not inadvertently break existing behavior.

tests/thread/reaction/reaction_test.go (2)

78-78: Validating Reaction Deletion
Again, passing nil for pagination in ThreadGetWithResponse is consistent with the pattern. Ensure test coverage includes valid queries with non-nil pagination when needed.


99-100: Shifting from Replies to Replies.Replies
This implies a new paginated data structure. The indexing logic to retrieve [0] is clear but watch for corner cases when no replies exist.

web/src/api/openapi-schema/index.ts (2)

296-296: Add docs or usage comments for PaginatedReplyList.

Consider adding inline JSDoc or references to guide new contributors on how to consume this new paginated data shape throughout the UI, especially for newcomers unfamiliar with the new approach.


297-297: Explain PaginatedReplyListAllOf usage.

Similar to the above, a short description or comment clarifying what is included in PaginatedReplyListAllOf might help maintain clarity in the future, particularly if aggregates or other fields appear here later.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 847c3be and cadb52e.

⛔ Files ignored due to path filters (1)
  • api/openapi.yaml is excluded by !**/*.yaml
📒 Files selected for processing (29)
  • app/resources/datagraph/hydrate/hydrator.go (2 hunks)
  • app/resources/post/thread/db.go (5 hunks)
  • app/resources/post/thread/repo.go (2 hunks)
  • app/resources/post/thread/thread.go (2 hunks)
  • app/resources/seed/post.go (5 hunks)
  • app/services/semdex/semdexer/pinecone_semdexer/index.go (1 hunks)
  • app/services/thread/delete.go (2 hunks)
  • app/services/thread/get.go (2 hunks)
  • app/services/thread/service.go (2 hunks)
  • app/services/thread/thread_semdex/indexer.go (1 hunks)
  • app/services/thread/update.go (2 hunks)
  • app/transports/http/bindings/threads.go (1 hunks)
  • app/transports/http/bindings/utils.go (1 hunks)
  • app/transports/http/openapi/server_gen.go (14 hunks)
  • tests/collection/items_test.go (3 hunks)
  • tests/like/like_test.go (2 hunks)
  • tests/thread/reaction/reaction_test.go (5 hunks)
  • tests/thread/thread_test.go (4 hunks)
  • web/src/api/openapi-client/threads.ts (4 hunks)
  • web/src/api/openapi-schema/index.ts (2 hunks)
  • web/src/api/openapi-schema/paginatedReplyList.ts (1 hunks)
  • web/src/api/openapi-schema/paginatedReplyListAllOf.ts (1 hunks)
  • web/src/api/openapi-schema/threadAllOf.ts (1 hunks)
  • web/src/api/openapi-schema/threadGetParams.ts (1 hunks)
  • web/src/api/openapi-server/threads.ts (2 hunks)
  • web/src/app/(dashboard)/t/[slug]/page.tsx (2 hunks)
  • web/src/components/thread/ReplyList/ReplyList.tsx (1 hunks)
  • web/src/screens/thread/ThreadScreen/ThreadScreen.tsx (3 hunks)
  • web/src/screens/thread/ThreadScreen/useThreadScreen.ts (3 hunks)
✅ Files skipped from review due to trivial changes (3)
  • web/src/api/openapi-schema/threadGetParams.ts
  • web/src/api/openapi-schema/paginatedReplyList.ts
  • web/src/api/openapi-schema/paginatedReplyListAllOf.ts
🔇 Additional comments (70)
app/resources/post/thread/db.go (10)

22-22: Add pagination import
Introducing the pagination package import aligns with the new pagination functionality, ensuring a consistent approach across the codebase.


25-25: Include reply handling import
Adding reply import is appropriate for transforming database rows into domain-level reply entities. This helps keep the code clean and maintainable.


289-301: Validate repliesCountQuery for performance and correctness
The query correctly counts the total replies and whether the requesting account has replied. However, consider verifying:

  1. Index coverage on root_post_id and deleted_at to ensure efficient lookups on large datasets.
  2. Potential counting edge cases (e.g., repeated or nested replies).

330-336: Initial retrieval of reply stats
The updated function signature includes pageParams pagination.Parameters, reflecting the newly added pagination requirement. Fetching replyStats here is consistent with your overall approach to gather aggregated metrics before assembling the final response.


338-338: Fetch likes from the database
Reusing the same pattern to retrieve likes maintains a consistent code style. Just ensure the query results align with the new pagination requirements if you plan to present likes in a paginated manner in the future.


408-410: Convert post edges to replies
Using dt.MapErr to map r.Edges.Posts into reply models is a clean and idiomatic approach. Verify correct handling of edge cases, such as when the array is empty or contains invalid data.


413-415: Leverage reply stats map
Storing replyStats in a map helps decouple data retrieval from business logic. This step looks good and avoids repeated calculations.


416-417: Create paginated results
pagination.NewPageResult properly wraps the replies into a paginated structure. Double-check any off-by-one boundary scenarios and confirm correct total count usage.


418-418: Mapper for final post
Wrapping the entity with FromModel while also supplying likes, collections, and replyStats is a clean design. Good job consolidating the logic.


424-425: Assign the paginated reply results
Setting p.Replies to the paginated result ensures a clear delineation between the main post information and the paginated replies. This aligns with the PR's goal of enhancing pagination capabilities.

app/transports/http/openapi/server_gen.go (10)

2785-2788: Verify downstream usage of the new PaginatedReplyList.
Replacing ReplyList with PaginatedReplyList might break any existing logic relying on Thread.Replies. Please confirm that all references are updated consistently throughout the codebase.


4666-4666: Confirm that all calls to ThreadGet pass the new params argument.
Since the method now accepts *ThreadGetParams, ensure that existing callers are updated, otherwise build or runtime errors might occur.


11398-11398: Method signature update is appropriate.
Changing NewThreadGetRequest to accept *ThreadGetParams matches the revised method signature.


12018-12018: Updated interface method signature aligns with the new parameter struct.
Ensure all interface implementations also accommodate *ThreadGetParams.


15861-15862: Handling the updated ThreadGet call is done properly.
Forwarding params to ThreadGet maintains consistency.


19754-19754: Revised ThreadGet handler signature is consistent with the new pagination approach.
This ensures the server can receive pagination parameters correctly.


21859-21867: Validate page parameters for invalid or negative values.
You correctly bind the query parameter to params.Page, but consider adding checks for out-of-range inputs to avoid potential runtime issues.


26709-26709: Adding the Params field to ThreadGetRequestObject is consistent.
This consolidates pagination parameters with other request details, which should simplify handling in the route.


30116-30120: Correct pass-through of the new params field.
Storing params in ThreadGetRequestObject aligns with the updated route signatures.


30230-30605: Auto-generated Swagger specification.
Typically, auto-generated documentation code is not manually reviewed because any changes risk breaking the generation process.

web/src/api/openapi-schema/threadAllOf.ts (1)

10-13: Ensure consistency with PaginatedReplyList definition

You've updated the replies property to use PaginatedReplyList. Verify that PaginatedReplyList is correctly defined (e.g., it must be imported and declared properly in "./paginatedReplyList") and that other references to replies in the codebase match this structure.

app/services/thread/thread_semdex/indexer.go (1)

16-16: Confirm default vs. custom pagination usage

Calling i.threadQuerier.Get with an empty pagination.Parameters{} suggests a default pagination. Verify whether you need a default page size, offset, or limit.

app/services/thread/get.go (2)

12-12: Import looks fine.
No issues with adding the pagination package import. This aligns well with the new pagination approach across the codebase.


29-29: Confirm correct usage of pageParams in the repository layer
You're correctly passing pageParams to the repository. Verify that any existing calls to s.thread_repo.Get outside this method are updated accordingly and that the repository properly handles invalid pagination parameters.

app/services/thread/delete.go (2)

13-13: New pagination import is consistent with the overall design
This import confirms that pagination is being applied consistently across the codebase. No issues here.


32-32: Using empty pagination parameters
Passing pagination.Parameters{} ensures the repository receives a consistent signature. Verify that the repository gracefully handles empty pagination values (e.g., defaulting to the first page).

web/src/screens/thread/ThreadScreen/useThreadScreen.ts (2)

12-12: New optional initialPage parameter
Great addition to allow initial pagination state. Ensure there's no confusion when initialPage is undefined or zero.


24-24: Function signature accommodates optional page
The updated signature aligns well with the new initialPage. Double-check that callers of useThreadScreen provide initialPage appropriately if needed.

app/resources/post/thread/thread.go (1)

14-14: New pagination import
No issues with pulling in the pagination package. This dependency is consistent with the approach used elsewhere in the code.

app/resources/datagraph/hydrate/hydrator.go (2)

17-17: New import for pagination parameters is consistent with the PR objective.
This aligns perfectly with the introduction of pagination logic across the application and is appropriately placed.


78-78: Ensure correct pagination usage.
Providing pagination.Parameters{} with no fields set may default to no pagination or rely on downstream defaults. Verify that this behavior meets the intended pagination requirements.

app/services/thread/update.go (2)

16-16: Imported the pagination package.
This import addition validates the shift toward structured pagination parameters.


43-43: Parameterizing the thread retrieval with pagination.
Passing pagination.Parameters{} to the Get method ensures consistent usage of pagination throughout the system. Confirm that the default parameters produce the expected behavior (e.g., a full dataset or the first page).

app/resources/post/thread/repo.go (2)

14-14: Pagination import is appropriately added.
This import signals a coherent shift to incorporate pagination in the thread repository.


57-57: Updated repository interface to include pagination parameters.
This change modifies the Get method signature, which could break compatibility with existing calls. Ensure all call sites are updated accordingly to prevent runtime errors.

web/src/api/openapi-server/threads.ts (2)

13-13: Introduction of ThreadGetParams type.
This is a solid approach to strongly type pagination (and other query) parameters.


98-112: Constructing query parameters for thread retrieval.
The new logic appends query parameters if they exist, enabling flexible thread fetching with pagination or filtering. Validate that all optional parameters are properly handled in the calling code.

web/src/screens/thread/ThreadScreen/ThreadScreen.tsx (3)

12-12: Importing PaginationControls for reply pagination
This is a solid decision to introduce a dedicated pagination component, clearly separating the pagination-related UI logic into a reusable component.


27-27: Switching to VStack
Using VStack to stack elements vertically helps with cleaner layout control and is consistent with the system’s styled components.


116-136: Implementing Pagination Controls for Replies
The approach of displaying the pagination controls both above and below the reply list is user-friendly. It ensures quick navigation for threads with numerous replies. The logic condition data.thread.replies.total_pages > 1 looks straightforward and well-implemented. Be mindful to handle potential off-by-one errors if the backend returns edge cases (e.g., an empty page).

app/transports/http/bindings/threads.go (1)

214-216: Passing Pagination Params to Service Layer
Including pp via deserialisePageParams and updating i.thread_svc.Get(ctx, postID, pp) is a good abstraction that keeps pagination logic centralized. Verify that potential invalid page inputs (e.g., negative values) are handled gracefully in deserialisePageParams.

tests/thread/reaction/reaction_test.go (5)

57-57: Using nil for Pagination Params
The addition of the nil parameter in ThreadGetWithResponse calls suggests an optional pagination usage. This approach appears consistent if default pagination logic is handled server-side.


96-96: Fetching Thread after Reply Reaction
Ensuring correct retrieval after a reaction or reply is good. No issues seen here.


121-121: Consistent ThreadGet Calls
Using the updated method with a nil parameter is consistent.


124-125: Accessing Nested Replies Array
Same note as above about Replies.Replies. Looks fine as long as the test environment ensures at least one reply.


144-144: Verifying React Uniqueness
This test ensures react spam is consolidated properly. The pagination parameter is omitted here, which is presumably correct for the scenario.

web/src/api/openapi-client/threads.ts (4)

146-150: Enhancing threadGet with optional ThreadGetParams
Extending the method signature to accept pagination or additional query parameters is a good approach for flexible data fetching.


154-155: Generating SWR Key with pagination parameters
Including params in the key ensures cached data is invalidated correctly when pagination changes.


175-175: Hook signature updated to accept pagination
This extension is helpful for hooking into thread data with different page contexts.


188-189: Conditional SWR Key creation
Making the SWR key dependent on threadMark and params ensures correct caching and revalidation.

tests/thread/thread_test.go (4)

76-76: Confirmed correct usage of paginated replies field
The transition from Replies to Replies.Replies correctly matches the new paginated replies structure.


96-96: Check for potential query parameters
Invoking ThreadGetWithResponse with nil might indicate an optional pagination or other query parameters. Confirm there's no unintended default behavior when passing nil in place of an explicit parameter object.


99-100: Accurate retrieval of reply IDs
Mapping reply IDs confirms the function's correctness in enumerating paginated replies. This approach is consistent with the new structure.


105-105: Consistent handling of session
Providing session2 alongside a nil parameter ensures this test case covers the expected authentication differences.

tests/like/like_test.go (2)

69-79: Ensuring like status with nil parameter
Using nil as the third parameter in ThreadGetWithResponse consistently sets up the retrieval context. Verify that this approach does not affect the session logic or produce unexpected results.


174-195: Accurate reply-likes retrieval in paginated structure
The switch to Replies.Replies[0] is valid for the paginated replies structure. The updated assertion logic accurately checks the user-specific like status on replies.

app/transports/http/bindings/utils.go (2)

121-121: Switch to serialiseThreadRepliesPaginatedList
Replacing direct reply mapping with a dedicated serialization function improves clarity and modularity for paginated data handling.


129-139: New serialiseThreadRepliesPaginatedList function
This helper efficiently wraps pagination data (CurrentPage, NextPage, etc.) together with the serialized replies. The approach is straightforward and maintains code consistency.

tests/collection/items_test.go (3)

169-169: Use of nil for additional parameters
Passing nil as the third argument to ThreadGetWithResponse indicates an optional or default parameter set. Confirm that this usage aligns with the function’s updated signature.
[approve]


183-183: Session-based differences in collection status
This logic effectively ensures that different sessions (owners vs. random users) see the correct collection statuses.


197-197: Guest session behavior
A nil session parallels guest user access, confirming that the resulting collection data is displayed without personal session data.

app/resources/seed/post.go (5)

17-17: Use consistent alias or naming approach for imports.

While this import is correct and descriptive, confirm that consistent naming or aliasing is used across files to ensure consistent readability for future contributors.


69-147: Good integration of pagination.Result.

Switching from a basic slice to this paginated structure provides strong alignment with the new pagination features. Ensure that existing logic handling plain slices is updated accordingly (e.g., ensuring no leftover references to the old Replies slice).


179-195: Maintain uniform approach for new paginated replies.

This block mirrors the approach used in Post_01_Welcome. Confirm that all references or call sites handle replies from Items to avoid breaking changes.


211-243: Ensure large text test coverage.

This thread is specifically designed for stress testing with large/hacky strings. Now that it is wrapped in pagination.Result, verify that boundary pagination scenarios (e.g., extremely large or zero-length data sets) remain well-handled.


288-288: Iterate over replies safely.

Looping over t.Replies.Items is correct for the new paginated structure. If additional pagination logic is introduced, confirm you filter or limit records as intended.

web/src/api/openapi-schema/index.ts (1)

408-408: Adopt consistent naming for threadGetParams.

This export matches the naming convention well. Verify that related types (e.g., “threadGetPayload”, “threadGetRequest”) also follow consistent naming in openapi-schema.

app/services/semdex/semdexer/pinecone_semdexer/index.go (1)

103-106: Short-circuit logic is beneficial but re-check concurrency.

Short-circuiting when no vector IDs exist avoids unnecessary processing. However, ensure that any parallel or batched job that expects a result set does not hang waiting for subsequent steps when nil, nil, nil is returned.

app/services/thread/service.go (2)

18-18: Import is aligned with new pagination logic.

This addition is consistent with the rest of the codebase’s approach to pagination. Continue verifying that all older references to reply slices point to the new pagination functionality.


59-59: Method signature updated to accommodate pagination.

Good job adding the pageParams argument. Ensure that all callers supply valid pagination parameters or a default for backward compatibility.

@@ -21,7 +21,7 @@ export function ReplyList({ thread }: Props) {
flexDir="column"
width="full"
>
{thread.replies.map((reply, i) => {
{thread.replies.replies.map((reply, i) => {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix inconsistent indexing in ReplyList

You're mapping over thread.replies.replies but using thread.replies[i - 1] instead of thread.replies.replies[i - 1]. This can lead to errors or undefined references. Consider updating both places to point to the same nested structure:

{thread.replies.replies.map((reply, i) => {
-  const previous = thread.replies[i - 1];
+  const previous = thread.replies.replies[i - 1];
   ...
})}

Committable suggestion skipped: line range outside the PR's diff.

@Southclaws Southclaws force-pushed the thread-reply-pagination branch from 4f38d1d to 2c87659 Compare January 2, 2025 20:47
@Southclaws Southclaws merged commit ccdbf70 into main Jan 2, 2025
4 checks passed
@Southclaws Southclaws deleted the thread-reply-pagination branch January 2, 2025 20:54
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.

1 participant