Skip to content

enhance: Implement admin new Changelog page UI. - #3041

Merged
shohag121 merged 4 commits into
developfrom
enhance/implement-reactive-changelog-page
Dec 26, 2025
Merged

enhance: Implement admin new Changelog page UI.#3041
shohag121 merged 4 commits into
developfrom
enhance/implement-reactive-changelog-page

Conversation

@MdAsifHossainNadim

@MdAsifHossainNadim MdAsifHossainNadim commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

update: Redesigned the Admin Panel "Changelog" page template for a better look and user experience.

Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.

Before Changes

Describe the issue before changes with screenshots(s).

After Changes

Describe the issue after changes with screenshot(s).

Feature Video (optional)

Link of detailed video if this PR is for a feature.

PR Self Review Checklist:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • Dedicated Changelog page in the admin dashboard with version history, expandable entries, and per-version highlighting
    • Package toggle to view Lite or Pro changelogs
    • "Jump to version" searchable dropdown with quick scroll-to and highlight
    • Visual badges for change types (New, Fix, Improvement) and collapsible change lists
    • Changelog link added to admin navigation
  • Style

    • Updated help menu icons and compact dropdown styling for a cleaner header experience

✏️ Tip: You can customize this high-level summary in your review settings.

MdAsifHossainNadim and others added 2 commits December 18, 2025 13:19
* Changelog ui color and appearance

* enhance: Refactor changelog page with modular components (SearchBar, ChangeBadge, PackageToggle)

---------

Co-authored-by: Md Asif Hossain Nadim <devianadim@gmail.com>
@coderabbitai

coderabbitai Bot commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a dedicated Changelog admin page and UI components, registers a new admin route, exposes a changelog URL from PHP, updates the admin header help menu rendering, and enables panel switching to the new changelog panel. (49 words)

Changes

Cohort / File(s) Summary
Backend changelog link
includes/Admin/Dashboard/Dashboard.php
Derives a dedicated changelog page slug/URL via a transient (dokan_legacy_changelog_page), computes changelog_page_slug/changelog_url, and replaces the legacy “What’s New” menu item to point to the new changelog URL.
Admin routing
src/admin/dashboard/components/Dashboard.tsx
Registers a new admin route with id changelog mapped to ChangelogPage at path /changelog.
Changelog page & orchestration
src/admin/dashboard/pages/changelog/index.tsx
New ChangelogPage: lazy-fetches lite/pro changelog data (apiFetch), caches results, manages active package, expanded/highlighted versions, per-version refs, scroll-to-version and highlight overlay, and renders loading/empty states or VersionRow list.
Changelog UI components
src/admin/dashboard/pages/changelog/ChangeBadge.tsx, src/admin/dashboard/pages/changelog/PackageToggle.tsx, src/admin/dashboard/pages/changelog/SearchBar.tsx, src/admin/dashboard/pages/changelog/VersionRow.tsx
Add four components: ChangeBadge (type colored badges + icons), PackageToggle (Lite/Pro toggle with Crown icon), SearchBar (jump-to-version searchable dropdown), and VersionRow (version card with grouped changes, expand/collapse, Latest badge).
Header menu refactor
src/admin/header/AdminBar.tsx
Replaces static help menu markup with dynamic rendering of help_menu_items, introduces lucide-react icon mapping, and updates Tailwind-based styling and dropdown animation/visibility logic.
Panel switcher
src/admin/panel-switcher/PanelSwitch.tsx
Adds changelog to supported panel keys so the panel-switch UI recognizes the new page.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User as Admin (User)
    participant Router as Admin Router (Dashboard.tsx)
    participant ChgPage as ChangelogPage (React)
    participant WPAPI as WP apiFetch
    participant PHP as Dashboard.php (server)

    User->>Router: Navigate to /changelog
    Router->>ChgPage: Mount ChangelogPage
    ChgPage->>WPAPI: apiFetch('/.../changelog?package=lite|pro')
    WPAPI-->>ChgPage: Returns changelog payload (string or JSON)
    ChgPage->>ChgPage: Normalize/cache data, set versions state
    ChgPage->>ChgPage: Render SearchBar, PackageToggle, VersionRow list
    User->>ChgPage: Use SearchBar → select version
    ChgPage->>ChgPage: scrollIntoView(versionRef), set highlight
    User->>PHP: AdminBar requests dashboard links/help menu
    PHP-->>User: Returns dashboard URLs including changelog_url
    User->>AdminBar: Click help menu item → open changelog_url
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas to focus:
    • src/admin/header/AdminBar.tsx — dynamic icon mapping, accessibility, dropdown show/hide transitions, and external-link handling.
    • src/admin/dashboard/pages/changelog/index.tsx — async fetching, normalization of string vs JSON responses, caching, DOM refs and scroll/highlight timing.
    • includes/Admin/Dashboard/Dashboard.php — transient logic and backward compatibility for legacy dashboard links.

Possibly related PRs

  • #3023 — Modifies includes/Admin/Dashboard/Dashboard.php for changelog/dashboard link resolution (direct overlap with PHP changes).
  • #2970 — Modifies admin dashboard routing and panel-switcher surfaces (related to Dashboard.tsx and routing surface).
  • #2939 — Touches src/admin/panel-switcher/PanelSwitch.tsx to add supported panel keys (same file/class of change).

Suggested reviewers

  • mrabbani
  • kzamanbd

Poem

🐰 I hopped through lines of code today,

New changelogs lined in bright array.
Lite or Pro — I toggle with glee,
Versions found and scrolled for me.
A tiny hop, a joyful deploy!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete; key sections like 'Changes proposed', 'How to test', and 'Before/After Changes' lack substantive detail despite the template requiring them. Provide detailed descriptions of the proposed changes, add specific testing steps or issue references, and include before/after screenshots to demonstrate the UI redesign.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change—implementing a new admin Changelog page UI—which matches the primary objective of the PR.
Linked Issues check ✅ Passed The PR successfully implements all linked issue objectives: renaming menu item to 'Changelog' [#4900], redesigning the Changelog page UI [#4900, #1318, #1331], updating the admin top-right hover card design [#4900], and improving overall appearance and functionality.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issues; the PR adds Changelog page components, updates the admin dashboard, modifies the header help menu styling, and adds changelog support to the panel switcher—all within the stated scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch enhance/implement-reactive-changelog-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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (8)
src/admin/header/AdminBar.tsx (1)

22-33: Consider removing unused mapping entry.

The 'custom-icon': Circle mapping doesn't appear to be used by any menu item defined in Dashboard.php. If this is intended as a placeholder for future extensibility via the dokan_admin_setup_guides_help_menu_items filter, consider adding a brief comment to clarify its purpose.

includes/Admin/Dashboard/Dashboard.php (2)

176-183: Consider renaming the menu item ID for consistency.

The menu item id remains 'whats-new' while the title is now 'Changelog'. This mismatch could cause confusion for developers using the filter to modify or target this item. Consider updating the ID to 'changelog' for clarity.

Note: This would require updating the corresponding icon mapping key in AdminBar.tsx from 'whats-new' to 'changelog'.

🔎 Proposed fix
                     [
-                        'id'       => 'whats-new',
+                        'id'       => 'changelog',
                         'title'    => esc_html__( 'Changelog', 'dokan-lite' ),
                         'url'      => $changelog_url . '#/changelog',
-                        'icon'     => 'whats-new',
+                        'icon'     => 'changelog',
                         'active'   => Helper::dokan_has_new_version(),
                         'external' => false,
                     ],

And in AdminBar.tsx:

 const lucideIconMapping = {
-    'whats-new': RefreshCw,
+    'changelog': RefreshCw,
     support: Headphones,

219-232: Inconsistent escaping function usage.

Lines 221 and 228 use __() while other menu items use esc_html__(). For consistency and security, consider using the same function throughout.

🔎 Proposed fix
                     [
                         'id'       => 'feature-request',
-                        'title'    => __( 'Request a Feature', 'dokan-lite' ),
+                        'title'    => esc_html__( 'Request a Feature', 'dokan-lite' ),
                         'url'      => 'https://wedevs.com/account/dokan-feature-requests/',
                         'icon'     => 'feature-request',
                         'external' => true,
                     ],
                     [
                         'id'       => 'import-dummy-data',
-                        'title'    => __( 'Import dummy data', 'dokan-lite' ),
+                        'title'    => esc_html__( 'Import dummy data', 'dokan-lite' ),
                         'url'      => $legacy_dashboard_url . '#/dummy-data',
                         'icon'     => 'import-data',
                         'external' => false,
                     ],
src/admin/dashboard/pages/changelog/ChangeBadge.tsx (1)

3-33: Consider consolidating badge configuration to reduce duplication.

Both getBadgeStyles() and renderIcon() use the same type-matching logic. A single configuration object could improve maintainability:

🔎 Proposed refactor
import { Hammer, TrendingUp, Rocket, LucideIcon } from 'lucide-react';

type BadgeConfig = {
    styles: string;
    icon: LucideIcon | null;
};

const badgeConfig: Record<string, BadgeConfig> = {
    'New': { styles: 'bg-teal-500 text-white', icon: Rocket },
    'New Module': { styles: 'bg-teal-500 text-white', icon: Rocket },
    'New Feature': { styles: 'bg-teal-500 text-white', icon: Rocket },
    'Fix': { styles: 'bg-red-500 text-white', icon: Hammer },
    'Improvement': { styles: 'bg-purple-500 text-white', icon: TrendingUp },
    'Improvements': { styles: 'bg-purple-500 text-white', icon: TrendingUp },
    'Update': { styles: 'bg-purple-500 text-white', icon: TrendingUp },
};

const defaultConfig: BadgeConfig = { styles: 'bg-blue-500 text-white', icon: null };

const ChangeBadge = ({ type }: { type: string }) => {
    const config = badgeConfig[type] || defaultConfig;
    const IconComponent = config.icon;

    return (
        <span className={`inline-flex items-center px-2 py-1 gap-[6px] rounded-[20px] text-xs font-semibold ${config.styles}`}>
            {IconComponent && <IconComponent size={12} />}
            {type}
        </span>
    );
};
src/admin/dashboard/pages/changelog/index.tsx (1)

42-76: Consider user-facing error feedback.

The function correctly handles API failures with console logging. Consider adding user-visible error feedback (e.g., a toast notification or error message) to improve UX when changelog data fails to load.

src/admin/dashboard/pages/changelog/SearchBar.tsx (1)

6-19: Extract shared types to avoid duplication.

The Version, VersionChanges, and ChangeItem interfaces are duplicated across multiple files. Consider extracting them to a shared types file (e.g., types.ts in the changelog directory) for maintainability.

src/admin/dashboard/pages/changelog/VersionRow.tsx (2)

5-18: Extract shared types to avoid duplication.

The Version, VersionChanges, and ChangeItem interfaces are duplicated across multiple changelog files. Extract them to a shared types.ts file for better maintainability.


33-40: Consider adding error handling for invalid dates.

The formatDate function doesn't handle invalid date strings, which could result in "Invalid Date" being displayed. Consider adding validation or a fallback.

🔎 Proposed fix
     const formatDate = ( dateString: string ) => {
         const date = new Date( dateString );
+        if (isNaN(date.getTime())) {
+            return dateString; // Return original string as fallback
+        }
         return date.toLocaleDateString( 'en-US', {
             day: 'numeric',
             month: 'long',
             year: 'numeric',
         } );
     };
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60223f8 and f63bbec.

📒 Files selected for processing (9)
  • includes/Admin/Dashboard/Dashboard.php
  • src/admin/dashboard/components/Dashboard.tsx
  • src/admin/dashboard/pages/changelog/ChangeBadge.tsx
  • src/admin/dashboard/pages/changelog/PackageToggle.tsx
  • src/admin/dashboard/pages/changelog/SearchBar.tsx
  • src/admin/dashboard/pages/changelog/VersionRow.tsx
  • src/admin/dashboard/pages/changelog/index.tsx
  • src/admin/header/AdminBar.tsx
  • src/admin/panel-switcher/PanelSwitch.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-19T06:19:41.376Z
Learnt from: mrabbani
Repo: getdokan/dokan PR: 2891
File: src/admin/dashboard/pages/vendors-single/InformationTabs/WithdrawTab.tsx:58-59
Timestamp: 2025-09-19T06:19:41.376Z
Learning: The Dokan codebase uses 'dokan-lite' as the text domain for WordPress internationalization (__() function calls).

Applied to files:

  • src/admin/header/AdminBar.tsx
⏰ 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: e2e tests (1, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: api tests (1, 1)
  • GitHub Check: e2e tests (3, 3)
🔇 Additional comments (18)
src/admin/panel-switcher/PanelSwitch.tsx (1)

23-23: LGTM!

The addition of 'changelog' to the supported keys correctly enables panel switching functionality for the new Changelog page, consistent with the route added in Dashboard.tsx.

src/admin/header/AdminBar.tsx (2)

161-162: Verify trust boundary for RawHTML content.

RawHTML renders content without escaping. While item.title originates from server-side PHP (mostly using esc_html__()), the dokan_admin_setup_guides_help_menu_items filter allows third-party plugins to inject menu items. Ensure documentation advises filter consumers to sanitize their titles, or consider escaping here if HTML support is not required.


131-169: Clean dynamic rendering implementation.

The refactored approach properly handles external vs. internal links with appropriate target and rel attributes, uses a sensible fallback icon, and applies consistent hover styling. This is more maintainable than the previous static markup approach.

src/admin/dashboard/components/Dashboard.tsx (2)

16-16: LGTM!

Import correctly references the new ChangelogPage component.


77-81: LGTM!

The new changelog route follows the established pattern of other routes in this file and correctly wires the ChangelogPage component to the /changelog path.

includes/Admin/Dashboard/Dashboard.php (1)

162-166: LGTM on changelog URL handling.

The changelog URL construction correctly mirrors the existing dashboard URL pattern, supporting both legacy and new admin panel modes via the transient check.

src/admin/dashboard/pages/changelog/ChangeBadge.tsx (1)

35-42: LGTM on the component rendering.

The badge renders cleanly with appropriate styling and optional icon support. The inline-flex layout with gap spacing works well for the icon + text combination.

src/admin/dashboard/pages/changelog/index.tsx (6)

8-13: LGTM!

The LoadingSpinner component is simple and correct.


79-81: LGTM!

The useEffect correctly triggers data fetching when the active package changes. The caching logic in fetchChangelog prevents redundant API calls.


84-88: LGTM!

Correctly resets UI state when switching between packages.


91-97: LGTM!

Standard toggle pattern for managing expanded state.


129-171: LGTM!

The conditional rendering logic correctly handles loading, data, and empty states.


173-200: LGTM!

The component structure and JSX are well-organized with clear layout sections.

src/admin/dashboard/pages/changelog/SearchBar.tsx (2)

32-45: LGTM!

The click-outside detection is correctly implemented with proper cleanup.


48-58: LGTM!

The filtering logic correctly handles both search and default display scenarios.

src/admin/dashboard/pages/changelog/PackageToggle.tsx (1)

4-15: LGTM!

The conditional rendering based on hasPro is correct.

src/admin/dashboard/pages/changelog/VersionRow.tsx (2)

54-80: LGTM with note on change type ordering.

The visible changes logic correctly limits items to 5 when collapsed. Note that the order depends on Object.keys(version.changes), which follows insertion order. Ensure the backend provides changes in the desired display order.


85-108: LGTM!

The sticky positioning and layout structure are well-implemented.

Comment thread src/admin/dashboard/pages/changelog/index.tsx
Comment thread src/admin/dashboard/pages/changelog/index.tsx
Comment thread src/admin/dashboard/pages/changelog/PackageToggle.tsx
Comment thread src/admin/dashboard/pages/changelog/SearchBar.tsx
Comment thread src/admin/dashboard/pages/changelog/VersionRow.tsx
Comment thread src/admin/dashboard/pages/changelog/VersionRow.tsx
@MdAsifHossainNadim MdAsifHossainNadim added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Dec 22, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (4)
src/admin/dashboard/pages/changelog/VersionRow.tsx (2)

128-145: Remove unnecessary optional chaining on item.title.

Lines 134 and 139 use item?.title with optional chaining, but the ChangeItem interface (lines 5-7) defines title as a required string property. The optional chaining is unnecessary and should be simplified to item.title.

🔎 Proposed fix
-                                            <li
-                                                key={ itemIndex }
-                                                className="flex items-start text-sm text-[#575757] mb-0"
-                                            >
-                                                { item?.title && (
-                                                    <span className="mr-2 text-sm text-[#575757]">
-
-                                                    </span>
-                                                ) }
-                                                <span>{ item?.title }</span>
-                                            </li>
+                                            <li
+                                                key={ itemIndex }
+                                                className="flex items-start text-sm text-[#575757] mb-0"
+                                            >
+                                                <span className="mr-2 text-sm text-[#575757]">
+
+                                                </span>
+                                                <span>{ item.title }</span>
+                                            </li>

148-158: Simplify button styles and remove unnecessary !important flags.

Line 152 contains redundant and conflicting focus styles with !important flags (!outline-none, !focus:outline-none, focus:ring-0, focus:border-0). This is a code smell indicating style conflicts in your CSS architecture. Remove the !important prefixes and consolidate the focus styles while ensuring an accessible focus indicator remains.

🔎 Proposed fix
                         <button
                             onClick={ onToggle }
-                            className="text-sm text-[#7047EB] hover:text-[#5a38bc] font-medium !outline-none !focus:outline-none focus:ring-0 focus:border-0 underline p-6 pt-0"
+                            className="text-sm text-[#7047EB] hover:text-[#5a38bc] font-medium underline p-6 pt-0 outline-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[#7047EB] focus-visible:ring-offset-2"
                         >

If the !important flags are required to override conflicting styles, address the root cause in your CSS architecture instead.

src/admin/dashboard/pages/changelog/index.tsx (2)

15-35: Import the Version type to fix TypeScript compilation error.

Lines 20 and 23 use the Version type in useState<Version[] | null>, but this type is not imported. The Version interface is defined in VersionRow.tsx (lines 14-18) but is not exported. This will cause a TypeScript compilation error.

To fix this, you need to either:

  1. Export the Version interface from VersionRow.tsx and import it here
  2. Define a shared types file for common interfaces
  3. Define the Version type locally in this file
🔎 Proposed fix (Option 1: Export from VersionRow)

In src/admin/dashboard/pages/changelog/VersionRow.tsx, export the Version interface:

-interface Version {
+export interface Version {
     version: string;
     released: string;
     changes: VersionChanges;
 }

Then import it in this file at the top:

 import SearchBar from './SearchBar';
 import { __ } from '@wordpress/i18n';
 import VersionRow from './VersionRow';
+import type { Version } from './VersionRow';
 import apiFetch from '@wordpress/api-fetch';
 import PackageToggle from './PackageToggle';
 import { useState, useEffect, useCallback, useRef } from '@wordpress/element';

100-117: Implement auto-dismiss for highlight state with proper cleanup.

The handleJumpToVersion function sets a highlight on the target version but never automatically dismisses it. Users must manually click the overlay (lines 190-195) to clear the highlight. A previous review expected a setTimeout to auto-dismiss the highlight after 2 seconds, but this functionality is entirely missing from the current implementation.

🔎 Proposed fix with timeout cleanup
+import { useState, useEffect, useCallback, useRef } from '@wordpress/element';
+
 const ChangelogPage = () => {
+    const highlightTimerRef = useRef<NodeJS.Timeout | null>(null);
     // ... existing state ...

     // Handle jump to version with highlight
     const handleJumpToVersion = ( index: number ) => {
         const versions = activePackage === 'lite' ? liteVersions : proVersions;
         if ( ! versions ) {
             return;
         }

         const version = versions[ index ];
         const versionKey = `${ activePackage }-${ version.version }`;
         const element = versionRefs.current[ versionKey ];

+        // Clear any existing highlight timer
+        if (highlightTimerRef.current) {
+            clearTimeout(highlightTimerRef.current);
+        }
+
         // Set highlight
         setHighlightedVersion( versionKey );

         // Scroll to element
         if ( element ) {
             element.scrollIntoView( { behavior: 'smooth', block: 'start' } );
         }
+
+        // Remove highlight after 2 seconds
+        highlightTimerRef.current = setTimeout( () => {
+            setHighlightedVersion( null );
+            highlightTimerRef.current = null;
+        }, 2000 );
     };

+    // Cleanup on unmount
+    useEffect(() => {
+        return () => {
+            if (highlightTimerRef.current) {
+                clearTimeout(highlightTimerRef.current);
+            }
+        };
+    }, []);
🧹 Nitpick comments (1)
src/admin/dashboard/pages/changelog/index.tsx (1)

42-76: Refactor fetchChangelog to avoid unnecessary callback recreations.

The useCallback dependency array (line 75) includes liteVersions and proVersions, causing the callback to be recreated every time these state values change. Since these dependencies are only used for null-checks (lines 45-50), this creates unnecessary churn. When fetchChangelog changes, the useEffect on lines 79-81 runs again, potentially causing unnecessary effect executions.

🔎 Proposed fix using refs to track loaded state
 const ChangelogPage = () => {
     const [ activePackage, setActivePackage ] = useState< 'lite' | 'pro' >(
         'lite'
     );
     const [ liteVersions, setLiteVersions ] = useState< Version[] | null >(
         null
     );
     const [ proVersions, setProVersions ] = useState< Version[] | null >(
         null
     );
+    const loadedPackages = useRef< Set<'lite' | 'pro'> >( new Set() );
     const [ loading, setLoading ] = useState( false );
     // ... rest of state ...

     // Fetch changelog data
     const fetchChangelog = useCallback(
         async ( pkg: 'lite' | 'pro' ) => {
             // Check if already loaded
-            if ( pkg === 'lite' && liteVersions !== null ) {
-                return;
-            }
-            if ( pkg === 'pro' && proVersions !== null ) {
+            if ( loadedPackages.current.has( pkg ) ) {
                 return;
             }

             setLoading( true );
             try {
                 const response = await apiFetch< string >( {
                     path: `/dokan/v1/admin/changelog/${ pkg }`,
                 } );

                 const data =
                     typeof response === 'string'
                         ? JSON.parse( response )
                         : response;

                 if ( pkg === 'lite' ) {
                     setLiteVersions( data );
                 } else {
                     setProVersions( data );
                 }
+                loadedPackages.current.add( pkg );
             } catch ( error ) {
                 // eslint-disable-next-line no-console
                 console.error( 'Failed to fetch changelog:', error );
             } finally {
                 setLoading( false );
             }
         },
-        [ liteVersions, proVersions ]
+        []
     );
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9750c80 and a5263ee.

📒 Files selected for processing (2)
  • src/admin/dashboard/pages/changelog/VersionRow.tsx
  • src/admin/dashboard/pages/changelog/index.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/admin/dashboard/pages/changelog/index.tsx (5)
src/stores/vendors/actions.ts (1)
  • setLoading (20-25)
assets/src/js/product-editor.js (1)
  • key (1887-1887)
src/vendor-dashboard/reports/analytics/settings/historical-data/layout.js (1)
  • response (144-148)
src/vendor-dashboard/reports/dashboard/components/connect/index.js (1)
  • error (170-170)
assets/src/js/setup-wizard/commission/index.js (1)
  • element (7-7)
⏰ 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: e2e tests (1, 3)
  • GitHub Check: e2e tests (2, 3)
  • GitHub Check: e2e tests (3, 3)
  • GitHub Check: api tests (1, 1)
🔇 Additional comments (10)
src/admin/dashboard/pages/changelog/VersionRow.tsx (5)

1-18: LGTM!

The imports and type definitions are well-structured. The ChangeItem interface correctly defines both title and description as required string properties.


20-40: LGTM!

The component props are clearly typed, and the date formatting implementation is correct.


42-80: LGTM!

The logic for calculating total items and determining visible changes is correct. The truncation strategy is deterministic and ensures exactly 5 items are shown when collapsed.


85-108: LGTM!

The left column layout with sticky positioning is well-implemented. The "Latest" badge and date formatting provide clear visual hierarchy.


110-127: LGTM!

The card structure with conditional highlight ring and section dividers is implemented correctly. The use of ChangeBadge for type indicators maintains consistency.

src/admin/dashboard/pages/changelog/index.tsx (5)

8-13: LGTM!

The loading spinner implementation is clean and uses standard Tailwind animation utilities.


37-39: LGTM!

The Pro availability check safely handles missing global state with optional chaining and a sensible default.


84-97: LGTM!

The package toggle and version expansion handlers are implemented correctly with appropriate state resets.


120-166: LGTM!

The content rendering logic correctly handles loading, populated, and empty states. The ref callback pattern for scroll targeting is properly implemented.


168-202: LGTM!

The main layout is well-structured with clear header and content sections. The overlay for dismissing highlights is properly positioned and interactive.

@mrabbani mrabbani added Dev Review Done and removed Needs: Dev Review It requires a developer review and approval labels Dec 23, 2025
@dev-shahed dev-shahed added 🎉 QA Approved This PR is approved by the QA team and removed Needs: Testing This requires further testing labels Dec 23, 2025
@shohag121
shohag121 merged commit a6019af into develop Dec 26, 2025
2 of 6 checks passed
@shohag121
shohag121 deleted the enhance/implement-reactive-changelog-page branch December 26, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dev Review Done 🎉 QA Approved This PR is approved by the QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants