Skip to content

fix: authenticate doesn't populate user with 0 id#176

Open
GaborTorma wants to merge 15 commits intomarshallswain:mainfrom
GaborTorma:main
Open

fix: authenticate doesn't populate user with 0 id#176
GaborTorma wants to merge 15 commits intomarshallswain:mainfrom
GaborTorma:main

Conversation

@GaborTorma
Copy link

I debug and fixed this issue and change test test for it.
Please merge it.
Thanks!

Copy link
Author

@GaborTorma GaborTorma left a comment

Choose a reason for hiding this comment

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

I upgraded all depenecies, incl. pinia v3.
You can release a new major version.

@gmercey gmercey requested review from Copilot and gmercey August 10, 2025 16:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request addresses an authentication issue where users with an ID of 0 were not properly populated during authentication and includes comprehensive test standardization changes.

Key changes:

  • Fixed authentication logic to properly handle users with ID 0 by changing the validation from falsy check to null check
  • Standardized test syntax from test() to it() across the entire codebase
  • Updated import organization to follow consistent patterns throughout the project

Reviewed Changes

Copilot reviewed 108 out of 117 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/use-auth/use-auth.test.ts Fixed authentication test to expect user ID 0 instead of 1, supporting the main fix
tests/fixtures/feathers.ts Updated mock authentication response to return user with ID 0 for testing
src/use-auth/use-auth.ts Fixed authentication bug by changing !userId.value to userId.value === null to properly handle ID 0
Multiple test files Standardized test function calls from test() to it() across all test files
Multiple source files Reorganized imports for consistent ordering and formatting

GaborTorma and others added 5 commits August 10, 2025 18:50
[nitpick] The authentication logic correctly changes from falsy check to strict null check, but the operator precedence should be clarified. Consider using explicit parentheses around the null check to make the intent clearer: if (!entityService || (userId.value === null)).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The TypeScript error suppression comment '// @ts-expect-error test' appears to be a placeholder or debugging comment that should be removed or replaced with a proper explanation of why the error is expected.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
[nitpick] The nullish coalescing operator (??) is used here, which is inconsistent with the strict null check on line 51. For consistency, consider using the same comparison approach throughout the authentication logic.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Another TypeScript error suppression comment '// @ts-expect-error test' that appears to be a placeholder. This should be properly documented or the underlying TypeScript issue should be resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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