Skip to content

Fixed Tailwind Issues#118

Open
bharathk08 wants to merge 2 commits intodevfrom
fix/tailwind
Open

Fixed Tailwind Issues#118
bharathk08 wants to merge 2 commits intodevfrom
fix/tailwind

Conversation

@bharathk08
Copy link
Copy Markdown
Contributor

@bharathk08 bharathk08 commented Apr 10, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Image asset now loads from a remote URL and uses eager loading for faster display.
  • Chores

    • Updated CSS purging to more narrowly target source files for leaner styles.
    • Adjusted build configuration: removed an unused plugin and added explicit environment-variable handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

Replaced a local book image import with a hardcoded S3 URL and added eager loading in LeftNav.jsx. Updated Tailwind purge to a glob. Modified gatsby-config.js plugins: removed gatsby-transformer-remark, added top-level gatsby-plugin-env-variables, and removed its nested entry.

Changes

Cohort / File(s) Summary
Component Asset Loading
src/components/LeftNav.jsx
Removed local book.png import; replaced <img> src with hardcoded S3 URL and added loading='eager', kept alt='book'.
CSS Build Configuration
tailwind.config.js
Changed purge from [] to ['./src/**/*.{js,jsx,ts,tsx,md}'] to target source files for unused-style removal.
Gatsby Plugins
gatsby-config.js
Removed top-level gatsby-transformer-remark; added top-level gatsby-plugin-env-variables with allowList for Typesense vars; removed nested gatsby-plugin-env-variables from options.plugins within the removed transformer config.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble bytes beneath the moonlit branch,
A book now sails from S3's bright expanse,
Tailwind trims its whiskers neat and slim,
Plugins shuffle—quiet, quick, not grim,
A rabbit hops, commits the tiny dance 🐇📚

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions only Tailwind issues, but the changeset includes significant modifications to gatsby-config.js (removing gatsby-transformer-remark, restructuring gatsby-plugin-env-variables) and LeftNav.jsx (replacing local image import with S3 URL), which are unrelated to Tailwind configuration. Revise the title to reflect all primary changes, such as 'Configure Tailwind purge, update Gatsby plugins, and migrate image to S3' or split into multiple focused pull requests.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tailwind

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.

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/LeftNav.jsx`:
- Line 88: The nav icon image in LeftNav.jsx is set to loading='eager', which
over-prioritizes non-critical images; update the <img> in the LeftNav component
(the child-row/book icon) to use lazy loading by removing or replacing
loading='eager' with loading='lazy' so icons are deferred until needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 20c60a49-0aac-425a-8ed8-6a2bbedb09f1

📥 Commits

Reviewing files that changed from the base of the PR and between 3b0fb17 and 9d18c7b.

📒 Files selected for processing (2)
  • src/components/LeftNav.jsx
  • tailwind.config.js

<li key={`${data.leftNavTitle || title}-${uuidv4()}`} className={`child${this.inUrl(url) ? ' currentUrl text_green' : ''}`}>
<div className="activeIndicator" />
<img src={book} alt="book"/>
<img src='https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/book.png' loading='eager' alt='book' />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid eager-loading nav icons.

Line 88 sets loading='eager' for each child-row icon; this can over-prioritize non-critical images. Prefer lazy loading here.

Suggested change
-                <img src='https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/book.png' loading='eager' alt='book' />
+                <img src='https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/book.png' loading='lazy' decoding='async' alt='book' />
📝 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
<img src='https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/book.png' loading='eager' alt='book' />
<img src='https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/book.png' loading='lazy' decoding='async' alt='book' />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LeftNav.jsx` at line 88, The nav icon image in LeftNav.jsx is
set to loading='eager', which over-prioritizes non-critical images; update the
<img> in the LeftNav component (the child-row/book icon) to use lazy loading by
removing or replacing loading='eager' with loading='lazy' so icons are deferred
until needed.

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@gatsby-config.js`:
- Line 25: The allowList array in the gatsby-plugin-env-variables configuration
currently includes the admin key string 'TYPESENSE_API_KEY' which exposes the
server-side admin key to the frontend; remove 'TYPESENSE_API_KEY' from the
allowList (leaving 'TYPESENSE_SEARCH_API_KEY' plus
host/port/protocol/collection) so only the search key and non-sensitive vars are
exposed via the allowList in the plugin configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f19f294a-a596-49d0-8be3-389f7fa9ee17

📥 Commits

Reviewing files that changed from the base of the PR and between 9d18c7b and 2aef1f9.

📒 Files selected for processing (1)
  • gatsby-config.js

{
resolve: 'gatsby-plugin-env-variables',
options: {
allowList: ['TYPESENSE_HOST', 'TYPESENSE_PORT', 'TYPESENSE_PROTOCOL', 'TYPESENSE_API_KEY', "TYPESENSE_SEARCH_API_KEY", "TYPESENSE_COLLECTION"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether TYPESENSE_API_KEY is actually consumed anywhere besides gatsby-config.js.
# Expected: client code should only reference TYPESENSE_SEARCH_API_KEY.

rg -n -C2 'TYPESENSE_API_KEY|TYPESENSE_SEARCH_API_KEY|TYPESENSE_COLLECTION|TYPESENSE_HOST|TYPESENSE_PORT|TYPESENSE_PROTOCOL'

Repository: testsigmahq/testsigma-tutorials

Length of output: 3835


Remove TYPESENSE_API_KEY from the client allow-list.

The client-side code in src/components/SearchInputBox.jsx only consumes TYPESENSE_SEARCH_API_KEY (plus host/port/protocol/collection). The gatsby-plugin-env-variables plugin exposes every allowList entry to the frontend bundle, making them visible to client-side scripts. TYPESENSE_API_KEY is the admin key used by scripts/indexr.js (a server-side build script) and should never be exposed to the browser.

Suggested change
-        allowList: ['TYPESENSE_HOST', 'TYPESENSE_PORT', 'TYPESENSE_PROTOCOL', 'TYPESENSE_API_KEY', "TYPESENSE_SEARCH_API_KEY", "TYPESENSE_COLLECTION"],
+        allowList: ['TYPESENSE_HOST', 'TYPESENSE_PORT', 'TYPESENSE_PROTOCOL', 'TYPESENSE_SEARCH_API_KEY', 'TYPESENSE_COLLECTION'],
📝 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
allowList: ['TYPESENSE_HOST', 'TYPESENSE_PORT', 'TYPESENSE_PROTOCOL', 'TYPESENSE_API_KEY', "TYPESENSE_SEARCH_API_KEY", "TYPESENSE_COLLECTION"],
allowList: ['TYPESENSE_HOST', 'TYPESENSE_PORT', 'TYPESENSE_PROTOCOL', 'TYPESENSE_SEARCH_API_KEY', 'TYPESENSE_COLLECTION'],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@gatsby-config.js` at line 25, The allowList array in the
gatsby-plugin-env-variables configuration currently includes the admin key
string 'TYPESENSE_API_KEY' which exposes the server-side admin key to the
frontend; remove 'TYPESENSE_API_KEY' from the allowList (leaving
'TYPESENSE_SEARCH_API_KEY' plus host/port/protocol/collection) so only the
search key and non-sensitive vars are exposed via the allowList in the plugin
configuration.

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