Skip to content

Comments

Display source maps for debugging#518

Closed
codycooperross wants to merge 15 commits intomasterfrom
debug-client-issue
Closed

Display source maps for debugging#518
codycooperross wants to merge 15 commits intomasterfrom
debug-client-issue

Conversation

@codycooperross
Copy link
Contributor

@codycooperross codycooperross commented Oct 9, 2025

Purpose

closes: Add github issue that originated this PR

Approach

Open Questions and Pre-Merge TODOs

Learning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

Summary by CodeRabbit

  • Chores

    • Enabled public browser source maps and React strict mode; disabled the explicit SWC minifier setting.
  • UI Changes

    • Removed several visualizations: related-aggregate graph, resource-types chart, licenses chart, and the Sankey graph; publication-year chart remains.
    • Removed the resource-type badge from work metadata; language badge preserved but its rendering implementation updated.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Warning

Rate limit exceeded

@codycooperross has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 4 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 19a26aa and ecb9031.

📒 Files selected for processing (1)
  • src/components/WorkMetadata/WorkMetadata.tsx (2 hunks)

Walkthrough

Updated Next.js config (public source maps, React strict mode enabled, swcMinify commented out). Disabled or removed several UI pieces: RelatedAggregateGraph on DOI page, resource-types & licenses charts in WorksDashboard, Sankey graph in WorksListing, and resourceType badge rendering in WorkMetadata while switching language badge to a forwarded/render-prop Badge.

Changes

Cohort / File(s) Summary
Next.js config
next.config.js
- Changed withSourceMaps devtool from 'hidden-source-map' to 'source-map' (public source maps).
- Added reactStrictMode: true to exported config.
- Commented out swcMinify: true (disabled in active config).
DOI page — remove RelatedAggregateGraph
src/app/(main)/doi.org/[...doi]/page.tsx
- Commented out RelatedAggregateGraph import and its Suspense render block; component no longer rendered.
WorksDashboard — disable resource-types & licenses charts
src/components/WorksDashboard/WorksDashboard.tsx
- Commented out imports, data-processing, tooltip helper, and JSX for resourceTypes and licenses charts.
- Kept publicationYear chart active; updated exported ShowCharts type to include publicationYear?: boolean.
WorksListing — remove Sankey graph
src/components/WorksListing/WorksListing.tsx
- Commented out SankeyGraph import, sankey data computation, default sankey title, and Sankey render; Sankey UI removed.
WorkMetadata — remove resourceType badge, use forwarded Badge for language
src/components/WorkMetadata/WorkMetadata.tsx
- Commented out tooltip resourceType logic and resourceType badge JSX (resourceType badge no longer rendered).
- Replaced direct Badge usage for language with a forwarded/render-prop ForwardedBadge wiring a ref through Badge; language tooltip retained.

Sequence Diagram(s)

No sequence diagram — changes are configuration updates and removal/replacement of UI components without new control flow to illustrate.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Attention areas:
    • Ensure commented imports/variables do not cause unused-import or TypeScript errors.
    • Confirm CI/build with devtool: 'source-map' and intended minification behavior after commenting swcMinify.
    • Verify no leftover references to RelatedAggregateGraph, SankeyGraph, or commented helpers that cause compile/runtime failures.
    • Check consumers of the updated ShowCharts type for compatibility.

Possibly related PRs

Suggested reviewers

  • jrhoads
  • wendelfabianchinsamy

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Display source maps for debugging" directly relates to a key change in the changeset: the modification in next.config.js where the devtool option was changed from 'hidden-source-map' to 'source-map', which makes source maps publicly available for debugging purposes. While the PR includes additional changes—such as commenting out various UI components (RelatedAggregateGraph, SankeyGraph, chart blocks) and updating configuration settings—the title appropriately highlights the main technical objective. The title is specific, concise, and clearly conveys the developer's primary intent, allowing reviewers to understand the core purpose of the change.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@cypress
Copy link

cypress bot commented Oct 9, 2025

akita    Run #1746

Run Properties:  status check passed Passed #1746  •  git commit 192705ab84 ℹ️: Merge ecb903100687b620d8245789d7d4575bc8f11f22 into abaa0742d474bd56c33079d8672e...
Project akita
Branch Review debug-client-issue
Run status status check passed Passed #1746
Run duration 01m 41s
Commit git commit 192705ab84 ℹ️: Merge ecb903100687b620d8245789d7d4575bc8f11f22 into abaa0742d474bd56c33079d8672e...
Committer codycooperross
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 47
View all changes introduced in this branch ↗︎

Copy link
Contributor

@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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8f31e7 and 9d4189f.

📒 Files selected for processing (1)
  • next.config.js (1 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). (5)
  • GitHub Check: test / cypress (4)
  • GitHub Check: test / cypress (1)
  • GitHub Check: test / cypress (2)
  • GitHub Check: test / cypress (3)
  • GitHub Check: test / cypress (5)

Comment on lines 1 to 5
// Use the hidden-source-map option when you don't want the source maps to be
// publicly available on the servers, only to the error reporting
const withSourceMaps = require('@zeit/next-source-maps')({
devtool: 'hidden-source-map'
devtool: 'source-map'
})
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Exposing source maps publicly is a security risk in production.

Switching from hidden-source-map to source-map makes source maps publicly accessible, exposing your source code to end users. This contradicts the comment above (lines 1-2) and creates a security vulnerability in production environments.

Additionally, the comment is now inconsistent with the implementation.

Consider using environment-based configuration to enable full source maps only in development:

-// Use the hidden-source-map option when you don't want the source maps to be
-// publicly available on the servers, only to the error reporting
+// Use source-map in development for debugging, hidden-source-map in production
+// to keep source maps private and only available to error reporting
 const withSourceMaps = require('@zeit/next-source-maps')({
-  devtool: 'source-map'
+  devtool: process.env.NODE_ENV === 'development' ? 'source-map' : 'hidden-source-map'
 })

If this change is temporary for debugging a specific issue, consider reverting it before merging to the target branch.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Use the hidden-source-map option when you don't want the source maps to be
// publicly available on the servers, only to the error reporting
const withSourceMaps = require('@zeit/next-source-maps')({
devtool: 'hidden-source-map'
devtool: 'source-map'
})
// Use source-map in development for debugging, hidden-source-map in production
// to keep source maps private and only available to error reporting
const withSourceMaps = require('@zeit/next-source-maps')({
devtool: process.env.NODE_ENV === 'development' ? 'source-map' : 'hidden-source-map'
})
🤖 Prompt for AI Agents
In next.config.js around lines 1 to 5 the devtool was set to 'source-map', which
exposes source maps publicly and contradicts the file comment; change the
configuration to use 'hidden-source-map' (or conditionally use 'source-map' only
when NODE_ENV !== 'production') and update the comment to match; implement an
environment check so production uses hidden-source-map while development uses
full source-map, and ensure the final comment accurately reflects the chosen
behavior.

Copy link
Contributor

@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)
src/components/WorksDashboard/WorksDashboard.tsx (1)

40-42: Remove unused data processing for commented-out charts.

Lines 40-42 compute resourceTypes and licenses data that is never used because the charts consuming this data are commented out (lines 57-74).

If the Resource Types and Licenses charts are permanently removed:

  1. Remove the data processing at lines 40-42
  2. Remove the commented chart render blocks at lines 57-74
  3. Update the ShowCharts type to remove these properties

If this is a temporary change for debugging, consolidate the explanation and ensure the data processing is also commented to avoid unnecessary computation on every render.

Also applies to: 57-74

🧹 Nitpick comments (4)
src/components/WorksListing/WorksListing.tsx (2)

16-16: Clarify intent and clean up if this is a permanent removal.

Similar to the DOI page, this change removes the SankeyGraph visualization, which appears unrelated to the PR objective of displaying source maps for debugging.

If this is a permanent removal, the component interface should be cleaned up to remove unused props: showSankey, sankeyTitle, and connectionTypesCounts (lines 21-23) are now unused.

If this is temporary, add a clear TODO comment.


40-40: Remove dead code and empty conditional blocks.

The commented-out sankeyTitle default parameter (line 40) and sankeyData computation (line 53) serve no purpose in the commented state.

Additionally, lines 77-81 create an empty conditional block that renders a <Col> with no content when showSankey is true. If the Sankey graph is permanently removed:

  1. Remove the entire conditional block (lines 77-81)
  2. Remove the commented parameter and data computation
  3. Update the Props interface to remove showSankey, sankeyTitle, and connectionTypesCounts

If temporary, consolidate explanations into a single clear comment block at the top of the file.

Also applies to: 53-53, 77-81

src/components/WorksDashboard/WorksDashboard.tsx (1)

9-10: Address commented imports and update type definitions.

The HorizontalStackedBarChart and color palette imports are commented out, consistent with removing Resource Types and Licenses charts below. However, this appears unrelated to the PR's stated purpose of displaying source maps for debugging.

If this removal is permanent:

  1. Remove the commented imports entirely
  2. Update the ShowCharts type (lines 15-23) to remove resourceTypes and licenses properties
  3. Clean up unused data processing (see next comment)

If temporary, add a clear explanation for why these charts are disabled.

src/app/(main)/doi.org/[...doi]/page.tsx (1)

13-13: Address commented code and clarify PR scope.

The RelatedAggregateGraph component is still actively used in the codebase (specifically in src/app/(embed)/embed/related-aggregate/[...doi]/page.tsx), so the component file and its dependencies must be retained. However, the commented import and component usage at lines 13 and 97-99 should be cleaned up.

Either:

  • Remove the commented lines entirely if this change is permanent
  • Add a TODO comment explaining the temporary removal (e.g., // TODO: Disabled while implementing source maps debugging - restore after #XYZ)

Additionally, clarify how this removal relates to the PR title "Display source maps for debugging"—the changes appear to affect component rendering rather than source map configuration.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b9725e and 12ce0fb.

📒 Files selected for processing (3)
  • src/app/(main)/doi.org/[...doi]/page.tsx (2 hunks)
  • src/components/WorksDashboard/WorksDashboard.tsx (3 hunks)
  • src/components/WorksListing/WorksListing.tsx (4 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). (1)
  • GitHub Check: test / cypress (2)

Copy link
Contributor

@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: 5

Caution

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

⚠️ Outside diff range comments (3)
src/components/WorksDashboard/WorksDashboard.tsx (2)

57-74: Remove block-commented JSX or restore functionality.

Large block comments containing JSX are a code smell and hinder maintainability. If the resourceTypes and licenses charts are being permanently removed, delete this entire block. If they're temporarily disabled, use conditional rendering with feature flags.

For permanent removal:

-        {/* {(show.resourceTypes || show.all) && <Col xs={12} sm={4}>
-          <HorizontalStackedBarChart
-            chartTitle={'Work Types'}
-            topCategory={{ title: resourceTypes.topCategory, percent: resourceTypes.topPercent }}
-            data={resourceTypes.data}
-            domain={resourceTypeDomain}
-            range={resourceTypeRange}
-            tooltipText={tooltipText('resourceType')} />
-        </Col>}
-        {(show.licenses || show.all) && <Col xs={12} sm={4}>
-          <HorizontalStackedBarChart
-            chartTitle='Licenses'
-            topCategory={{ title: licenses.topCategory, percent: licenses.topPercent }}
-            data={licenses.data}
-            domain={[...otherDomain, ...licenses.data.map(l => l.title)]}
-            range={[...otherRange, ...licenseRange]}
-            tooltipText={'The field "rights" from DOI metadata was used to generate this chart, showing the % of licenses used across works.'} />
-        </Col>} */}

For temporary disabling via feature flag:

-        {/* {(show.resourceTypes || show.all) && <Col xs={12} sm={4}>
+        {ENABLE_RESOURCE_CHARTS && (show.resourceTypes || show.all) && <Col xs={12} sm={4}>
           <HorizontalStackedBarChart
             chartTitle={'Work Types'}
             topCategory={{ title: resourceTypes.topCategory, percent: resourceTypes.topPercent }}
             data={resourceTypes.data}
             domain={resourceTypeDomain}
             range={resourceTypeRange}
             tooltipText={tooltipText('resourceType')} />
-        </Col>}
+        </Col>}
+        {ENABLE_RESOURCE_CHARTS && (show.licenses || show.all) && <Col xs={12} sm={4}>
-        {(show.licenses || show.all) && <Col xs={12} sm={4}>
           <HorizontalStackedBarChart
             chartTitle='Licenses'
             topCategory={{ title: licenses.topCategory, percent: licenses.topPercent }}
             data={licenses.data}
             domain={[...otherDomain, ...licenses.data.map(l => l.title)]}
             range={[...otherRange, ...licenseRange]}
             tooltipText={'The field "rights" from DOI metadata was used to generate this chart, showing the % of licenses used across works.'} />
-        </Col>} */}
+        </Col>}

15-23: Update ShowCharts type to reflect disabled features.

The ShowCharts type still includes resourceTypes?: boolean and licenses?: boolean, but these properties are no longer functional since the corresponding charts are commented out. This creates a misleading API surface where consumers can pass these props but they have no effect.

If the charts are permanently removed, update the type:

 export type ShowCharts = {
   publicationYear?: boolean
-  resourceTypes?: boolean
-  licenses?: boolean
   creatorsAndContributors?: boolean
   fieldsOfScience?: boolean
   languages?: boolean
   all?: boolean
 }

If they're temporarily disabled, add JSDoc comments to warn consumers:

export type ShowCharts = {
  publicationYear?: boolean
  /** @deprecated Temporarily disabled for debugging */
  resourceTypes?: boolean
  /** @deprecated Temporarily disabled for debugging */
  licenses?: boolean
  creatorsAndContributors?: boolean
  fieldsOfScience?: boolean
  languages?: boolean
  all?: boolean
}
src/components/WorkMetadata/WorkMetadata.tsx (1)

23-30: Remove non-functional showClaimStatus prop and update all call sites.

The showClaimStatus prop is defined in Props (line 26) but commented out in destructuring (line 35) and never used. Two components actively pass this prop expecting functionality:

  • src/components/WorksListing/WorksListing.tsx:85
  • src/components/Work/Work.tsx:20

To resolve this breaking change, remove the prop from the Props interface and update both call sites:

 type Props = {
   metadata: Work
   linkToExternal?: boolean
-  showClaimStatus?: boolean
   hideTitle?: boolean
   hideMetadataInTable?: boolean
   includeMetricsDisplay?: boolean
 }

Update src/components/WorksListing/WorksListing.tsx:85:

-            <WorkMetadata metadata={doi} linkToExternal={false} showClaimStatus={showClaimStatus} />
+            <WorkMetadata metadata={doi} linkToExternal={false} />

Update src/components/Work/Work.tsx:20:

-    <WorkMetadata metadata={doi} linkToExternal={true} showClaimStatus={false} hideMetadataInTable hideTitle />
+    <WorkMetadata metadata={doi} linkToExternal={true} hideMetadataInTable hideTitle />

Also uncomment the destructuring parameter at line 35 if the feature is being restored:

 export default function WorkMetadata({
   metadata,
   linkToExternal,
-  // showClaimStatus,
+  showClaimStatus,
   hideTitle = false,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12ce0fb and 70af2de.

📒 Files selected for processing (2)
  • src/components/WorkMetadata/WorkMetadata.tsx (6 hunks)
  • src/components/WorksDashboard/WorksDashboard.tsx (5 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). (5)
  • GitHub Check: test / cypress (2)
  • GitHub Check: test / cypress (4)
  • GitHub Check: test / cypress (5)
  • GitHub Check: test / cypress (1)
  • GitHub Check: test / cypress (3)

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