Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Workflow detail: improve default workflow diagram framing for legibility while still allowing manual zoom-out to view the full graph. [PR #524](https://github.com/riverqueue/riverui/pull/524).
- Workflow detail: truncate long workflow names in the header to prevent overflow and add a copy button for the full name. [PR #524](https://github.com/riverqueue/riverui/pull/524).
- JSON viewer: sort keys alphabetically in rendered and copied output for object payloads. [PR #525](https://github.com/riverqueue/riverui/pull/525).
- Job state sidebar: only highlight `Running` when the selected jobs state is actually running, even with retained search filters in the URL. [Fixes #526](https://github.com/riverqueue/riverui/issues/526). [PR #527](https://github.com/riverqueue/riverui/pull/527).

## [v0.15.0] - 2026-02-26

Expand Down
67 changes: 67 additions & 0 deletions src/components/JobStateFilters.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { JobState } from "@services/types";
import {
createMemoryHistory,
createRootRoute,
createRoute,
createRouter,
Outlet,
RouterProvider,
stripSearchParams,
} from "@tanstack/react-router";
import { render, screen } from "@testing-library/react";
import { describe, expect, test } from "vitest";

import { defaultValues, jobSearchSchema } from "../routes/jobs/index.schema";
import { JobStateFilters } from "./JobStateFilters";

const rootRoute = createRootRoute({
component: () => <Outlet />,
});

const jobsRoute = createRoute({
component: () => <JobStateFilters />,
getParentRoute: () => rootRoute,
path: "/jobs",
search: {
middlewares: [stripSearchParams(defaultValues)],
},
validateSearch: jobSearchSchema,
});

const routeTree = rootRoute.addChildren([jobsRoute]);

const renderWithLocation = async (location: string) => {
const history = createMemoryHistory({
initialEntries: [location],
});

const router = createRouter({
history,
routeTree,
});

await router.load();

return render(<RouterProvider router={router} />);
};

describe("JobStateFilters", () => {
test("only the selected state link is active", async () => {
await renderWithLocation(`/jobs?state=${JobState.Discarded}`);

const discardedLink = await screen.findByRole("link", {
name: "Discarded",
});
const runningLink = screen.getByRole("link", { name: "Running" });

expect(discardedLink).toHaveAttribute("data-status", "active");
expect(runningLink).not.toHaveAttribute("data-status", "active");
});

test("running is active when no state is explicitly selected", async () => {
await renderWithLocation("/jobs");

const runningLink = await screen.findByRole("link", { name: "Running" });
expect(runningLink).toHaveAttribute("data-status", "active");
});
});
4 changes: 4 additions & 0 deletions src/components/JobStateFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const JobStateFilters: (
return (
<li key={item.name}>
<Link
activeOptions={{
exact: true,
includeSearch: true,
}}
activeProps={{
className:
"bg-gray-50 dark:bg-gray-800 text-indigo-600 dark:text-slate-100",
Expand Down
Loading