refactor(web): resolve #5513 TODO by using branchUserLabel in agent-shell-layout - #5548
Open
pedrofrxncx wants to merge 1 commit into
Open
refactor(web): resolve #5513 TODO by using branchUserLabel in agent-shell-layout#5548pedrofrxncx wants to merge 1 commit into
pedrofrxncx wants to merge 1 commit into
Conversation
…hell-layout The branchUserLabel helper was added in #5513 to handle Better Auth's empty display name issue (stored as "" not null). This resolves the TODO that was waiting for that PR to land, reducing code duplication and using the single authorized place for that fallback logic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves a TODO in agent-shell-layout that was waiting for #5513 to land. That PR added the
branchUserLabelhelper to handle Better Auth's quirk of storing an unset display name as""(not null), which made the previous??-based fallback skip the email local-part and always slug to"user".Replaces the manual fallback expression with a call to
branchUserLabel, reducing code duplication and moving the logic to its single authorized home in the shared branch-name module.Change
branchUserLabelto the import from@decocms/shared/branch-namesession?.user?.name || session?.user?.email?.split("@")[0]expression withbranchUserLabel(session?.user)Net: -3 lines, behavior unchanged (the
branchUserLabelimplementation uses||instead of??, which is the fix #5513 made)Testing
No existing test file for this component. Verified with:
bun run fmt— passingcd apps/web && bunx tsc --noEmit— no type errorsbunx oxlint apps/web/src/layouts/agent-shell-layout/index.tsx— no lint errorsCI runs full type check and test suite.
Summary by cubic
Use
branchUserLabelfrom@decocms/shared/branch-nameinagent-shell-layoutto centralize user label fallback and keep branch names correct when Better Auth sets an empty display name.name || email local-partwithbranchUserLabel(session?.user).Written for commit 49914a3. Summary will update on new commits.