Skip to content

fix: improve mobile UX for Specification Explorer.#5455

Open
Sourya07 wants to merge 4 commits into
asyncapi:masterfrom
Sourya07:fix/sepcification
Open

fix: improve mobile UX for Specification Explorer.#5455
Sourya07 wants to merge 4 commits into
asyncapi:masterfrom
Sourya07:fix/sepcification

Conversation

@Sourya07
Copy link
Copy Markdown
Contributor

@Sourya07 Sourya07 commented May 22, 2026

Description
fixes -> #5107
image

before ->
image

as recommended by -> #5107 (comment)
current fix ->https://deploy-preview-5455--asyncapi-website.netlify.app/docs/reference/specification/v3.0.0-explorer

Summary by CodeRabbit

  • Bug Fixes

    • Prevents unnecessary schema loading when the explorer isn’t available.
  • Enhancements

    • Improved responsive detection so docs adapt more reliably to screen size.
    • Shows a full-screen message on small/mobile screens when the Specification Explorer isn’t available, with a link to the reference.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5415b27
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/6a10502ca6cf8300086581b7
😎 Deploy Preview https://deploy-preview-5455--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

Visualizer detects when the viewport is narrower than 1024px and prevents schema loading/rendering; DocsLayout adds a mobile-only “Specification Explorer is not available” screen and renders the desktop explorer layout only on large viewports.

Changes

Responsive Explorer UI

Layer / File(s) Summary
Viewport availability detection and schema guard
components/docs/Visualizer.tsx
Visualizer uses matchMedia('(min-width: 1024px)') to track availability, clears/prevents schema loading when unavailable, and gates rendering on both isExplorerAvailable and schema.
Mobile fallback UI and responsive layout
components/layout/DocsLayout.tsx
Adds IconExplorer import and a MobileExplorerUnavailable component; explorer route now renders the mobile fallback under lg:hidden and the desktop sidebar/children under lg:block.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A little rabbit checks the screen at night,
If width is small, the explorer hides from sight.
A friendly message hops into view,
Link in paw, pointing where docs are true.
Small screens rest—large screens play, UI feels right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: improving mobile user experience for the Specification Explorer feature through responsive design and unavailability messaging.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@asyncapi-bot
Copy link
Copy Markdown
Contributor

asyncapi-bot commented May 22, 2026

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 34
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-5455--asyncapi-website.netlify.app/

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f54cf6e) to head (5415b27).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5455   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          906       906           
  Branches       171       171           
=========================================
  Hits           906       906           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/layout/DocsLayout.tsx`:
- Line 93: DocsLayout currently hardcodes the fallback spec link
href='/docs/reference/specification/v3.0.0'; update the component to derive the
reference URL from the current page slug/path instead of using a fixed version.
In the DocsLayout component, read the current route (e.g., via the router or
path/slug prop used in this layout) and construct the href dynamically (for
example using the extracted version segment or full slug) so mobile users are
routed to the same explorer version they opened; replace the hardcoded string in
the link with this computed URL (ensure you update uses of the link target in
DocsLayout to reference the new computed variable).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 25d4c529-8fa0-41d4-a637-190e0ab06e26

📥 Commits

Reviewing files that changed from the base of the PR and between f54cf6e and 68df986.

📒 Files selected for processing (2)
  • components/docs/Visualizer.tsx
  • components/layout/DocsLayout.tsx

Comment thread components/layout/DocsLayout.tsx Outdated
Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
components/docs/Visualizer.tsx (1)

36-42: 💤 Low value

Simplify the early-return cleanup.

When the explorer is unavailable, the cleanup function sets isMounted = false, but no async operation is running that would check this flag. The cleanup can be omitted entirely in this branch for clarity.

♻️ Proposed simplification
 if (!isExplorerAvailable) {
   setSchema(null);
-
-  return () => {
-    isMounted = false;
-  };
+  return;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/docs/Visualizer.tsx` around lines 36 - 42, The early-return branch
that checks isExplorerAvailable and calls setSchema(null) should drop the
unnecessary cleanup; remove the returned function that sets isMounted = false
from that branch because no async work relies on isMounted there. Update the
Visualizer effect/handler containing isExplorerAvailable, setSchema, and
isMounted so that when !isExplorerAvailable you only call setSchema(null) and
return immediately without a cleanup function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@components/docs/Visualizer.tsx`:
- Around line 36-42: The early-return branch that checks isExplorerAvailable and
calls setSchema(null) should drop the unnecessary cleanup; remove the returned
function that sets isMounted = false from that branch because no async work
relies on isMounted there. Update the Visualizer effect/handler containing
isExplorerAvailable, setSchema, and isMounted so that when !isExplorerAvailable
you only call setSchema(null) and return immediately without a cleanup function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 243bd853-95f6-4542-8528-050487d401a4

📥 Commits

Reviewing files that changed from the base of the PR and between 68df986 and 5eb7803.

📒 Files selected for processing (2)
  • components/docs/Visualizer.tsx
  • components/layout/DocsLayout.tsx

@Sourya07
Copy link
Copy Markdown
Contributor Author

@princerajpoot20
@anshgoyalevil
plesae take a look on this
thanks

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
components/layout/DocsLayout.tsx (1)

127-127: ⚡ Quick win

Gate explorer UI using post.slug instead of router.pathname

DocsLayout already receives the resolved post, and this codebase also uses router.pathname to look up that same post by exact slug (getDocBySlug(..., pathname)), so the “route template vs concrete URL” pitfall is unlikely to break the current flow. Still, the explorer-specific branch at components/layout/DocsLayout.tsx:127 can be made more direct/robust by switching to post.slug.includes('-explorer') (or post.slug.endsWith('-explorer')) rather than router.pathname.includes(...).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/layout/DocsLayout.tsx` at line 127, The conditional in DocsLayout
uses router.pathname.includes('-explorer') which can be fragile; switch the gate
to inspect the resolved post slug instead (e.g., use
post.slug.includes('-explorer') or post.slug.endsWith('-explorer')) so the
explorer UI branch is determined from the actual post object passed into
DocsLayout; update the conditional at the branch that currently checks
router.pathname to use post.slug and keep behavior otherwise unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@components/layout/DocsLayout.tsx`:
- Line 127: The conditional in DocsLayout uses
router.pathname.includes('-explorer') which can be fragile; switch the gate to
inspect the resolved post slug instead (e.g., use
post.slug.includes('-explorer') or post.slug.endsWith('-explorer')) so the
explorer UI branch is determined from the actual post object passed into
DocsLayout; update the conditional at the branch that currently checks
router.pathname to use post.slug and keep behavior otherwise unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca0f024f-1542-4bd6-aa3f-06897694fbe8

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb7803 and 5415b27.

📒 Files selected for processing (1)
  • components/layout/DocsLayout.tsx

@princerajpoot20
Copy link
Copy Markdown
Member

@Sourya07 please attach before and after both evidence so what we can easily compare.
also attach the link you used (netlify page link) so it is easier for us to navigate and test it out if we want

@princerajpoot20
Copy link
Copy Markdown
Member

also let's take this PR after dark theme rollout planned by end of this month. otherwise we need to resolve conflicts

@Sourya07
Copy link
Copy Markdown
Contributor Author

okay got it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

3 participants