Skip to content

Conversation

Oksamies
Copy link
Contributor

@Oksamies Oksamies commented Sep 4, 2025

It somehow caused runaway dom node creation and 100% cpu usage

Summary by CodeRabbit

  • Refactor
    • Simplified the package page by removing in-app wiki loading and dynamic permission checks.
    • The Wiki tab is now a static, always-available link; wiki content is no longer fetched or rendered within the page.
    • Removed in-page handling of wiki errors (including 404s); users will navigate directly to the wiki source.
    • Streamlines tab rendering for faster, more consistent navigation without background wiki requests.

It somehow caused runaway dom node creation and 100% cpu usage
Copy link

coderabbitai bot commented Sep 4, 2025

Walkthrough

The package listing page removes all wiki-related data fetching, error handling, and dynamic UI logic. Loader and clientLoader no longer return wiki data. The component no longer awaits wiki content or permissions and renders a static Wiki tab. Related imports and types are removed accordingly.

Changes

Cohort / File(s) Summary of changes
Package listing wiki removal
apps/cyberstorm-remix/app/p/packageListing.tsx
Removed wiki fetching (including ApiError handling), dropped wiki from loader/clientLoader return types and useLoaderData, deleted Suspense/Await-based wiki tab logic and permission gating, removed related imports (ApiError, getPackageWiki, isPromise), and rendered a static Wiki tab link.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant R as Remix loader (Before)
  participant API as getPackageWiki
  participant C as Component (Before)

  U->>R: Request package listing
  R->>API: Fetch wiki (may 404)
  API-->>R: Wiki data or error
  R-->>C: loader data { community, listing, team, permissions, wiki }
  note over C: Suspense/Await on wiki / permission checks
  C->>C: Decide if Wiki tab enabled
  C-->>U: Render tabs (Wiki dynamic)
Loading
sequenceDiagram
  autonumber
  actor U as User
  participant R as Remix loader (After)
  participant C as Component (After)

  U->>R: Request package listing
  R-->>C: loader data { community, listing, team, permissions }
  note over C: No wiki fetching or awaiting
  C-->>U: Render tabs (Wiki static link)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws—less hops to take,
The wiki trail’s no longer at stake.
Tabs align, the path is clean,
No suspense behind the scene.
With lighter packs we onward leap,
To simpler code and restful sleep. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 09-04-remove_promise.withresolvers_usage_from_package_detail_page

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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Contributor Author

Oksamies commented Sep 4, 2025

@Oksamies
Copy link
Contributor Author

Oksamies commented Sep 4, 2025

Ah I'm dumdum. Of course it's going to cause infinite re-rendering, as the promise gets created on each re-render again. Cause I didn't put in an useEffect 🥇

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/cyberstorm-remix/app/p/packageListing.tsx (1)

168-196: Remove Promise.withResolvers here and eliminate remaining usages across the repo

The PR’s goal is to fully remove Promise.withResolvers. Apply this refactor in apps/cyberstorm-remix/app/p/packageListing.tsx, and also remove or replace the two remaining occurrences in:

  • packages/graph-system/src/executor.ts
  • packages/ts-uploader/src/uploaders/MultipartUpload.ts

Apply to packageListing.tsx:

-    // We do some trickery right here to prevent unnecessary request when the user is not logged in
-    let permissionsPromise = undefined;
-    const cu = await tools.getSessionCurrentUser();
-    if (cu.username) {
-      const wrapperPromise =
-        Promise.withResolvers<
-          Awaited<ReturnType<typeof getPackagePermissions>>
-        >();
-      dapper
-        .getPackagePermissions(
-          params.communityId,
-          params.namespaceId,
-          params.packageId
-        )
-        .then(wrapperPromise.resolve, wrapperPromise.reject);
-      permissionsPromise = wrapperPromise.promise;
-    }
+    // Prevent unnecessary request when the user is not logged in
+    const cu = await tools.getSessionCurrentUser();
+    const permissions =
+      cu?.username
+        ? dapper.getPackagePermissions(
+            params.communityId,
+            params.namespaceId,
+            params.packageId
+          )
+        : undefined;
@@
-      permissions: permissionsPromise,
+      permissions,
🧹 Nitpick comments (2)
apps/cyberstorm-remix/app/p/packageListing.tsx (2)

77-77: Avoid importing implementation just for types

This import is only used to express a type in the (now removable) withResolvers block. Keeping it pulls runtime code from an internal module path and risks bundling it. After removing withResolvers, drop this import. If you still need a type, use import type.

-import { getPackagePermissions } from "@thunderstore/dapper-ts/src/methods/package";
+// (removed) type-only import no longer needed after refactor

707-721: Consider disabling Wiki tab when no wiki exists

Static Wiki tab is fine, but if some packages don’t have a wiki, the link could route to an empty/404 state. You can mirror the Changelog pattern to disable the tab when absent.

                 <NewLink
                   key="wiki"
                   primitiveType="cyberstormLink"
                   linkId="PackageWiki"
                   community={listing.community_identifier}
                   namespace={listing.namespace}
                   package={listing.name}
                   aria-current={currentTab === "wiki"}
                   rootClasses={`tabs-item${
                     currentTab === "wiki" ? " tabs-item--current" : ""
                   }`}
+                  disabled={!listing.has_wiki}
                 >
                   Wiki
                 </NewLink>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aa78846 and 3a78983.

📒 Files selected for processing (1)
  • apps/cyberstorm-remix/app/p/packageListing.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Generate visual diffs
  • GitHub Check: ESLint
  • GitHub Check: Test
  • GitHub Check: CodeQL
🔇 Additional comments (1)
apps/cyberstorm-remix/app/p/packageListing.tsx (1)

203-205: LGTM: loader data shape

useLoaderData no longer includes wiki and carries permissions (promise | undefined). Matches the simplified UI flow.

@Oksamies Oksamies merged commit 2b18496 into master Sep 4, 2025
23 of 24 checks passed
@Oksamies Oksamies deleted the 09-04-remove_promise.withresolvers_usage_from_package_detail_page branch September 4, 2025 19:25
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