Skip to content

[BUG] Fix invalid TypeScript property in encode and make settings mock stateful #3305

Description

@rudrakshtank

Bug Description

There are two issues in this file:

TypeScript Error: The encode function from next-auth/jwt does not accept a cookieName property in its parameter object. Including it causes a TypeScript compilation error (Object literal may only specify known properties).

Stateless Mocking causing Flakiness/Failure: The intercepted **/api/user/settings route is stateless. It hardcodes is_public: false for all GET requests. When the test clicks the toggle to enable the public profile, the frontend sends a PATCH request (which the mock handles). However, modern data-fetching libraries (like SWR or React Query) typically invalidate their cache after a mutation, triggering an immediate GET request to re-sync the UI. This subsequent GET request hits the mock, receives the hardcoded is_public: false, and instantly reverts the checkbox to an unchecked state, causing the expect(...).toBeChecked() assertion to fail.

Steps to Reproduce

Run the Playwright test in a strictly typed Next.js/TypeScript environment; it will fail to build due to the invalid cookieName property.

If compilation passes, the test navigates to /dashboard/settings and clicks the "Toggle Public Profile" track.

The frontend dispatches a PATCH request to update the setting.

The frontend invalidates its cache and dispatches a GET request to **/api/user/settings.

The mock intercepts the GET request and returns { is_public: false }.

The frontend receives the stale data and flips the toggle back to unchecked.

The test assertion await expect(publicProfileCheckbox).toBeChecked() fails because the checkbox is now unchecked.

Affected Area

Other

Screenshots

No response

Browser & OS

No response

Environment

None

Additional Context

/assign

Activity

  1. rudrakshtank commented on Jul 31, 2026

    @rudrakshtank
    ContributorAuthor

    /assign

  2. github-actions commented on Jul 31, 2026

    @github-actions

    Assigned to @rudrakshtank! You have 7 days to open a PR. No PR after 7 days = auto-unassigned so others can pick it up. Good luck!

  3. github-actions commented on Jul 31, 2026

    @github-actions

    ✅ Closed as completed!

    If DevTrack has been useful, a ⭐ star on the repo helps the project grow and reach more developers.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-triageNeeds maintainer triage

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions