Skip to content

Commit

Permalink
Merge pull request #60 from ETLOnline/issue-42-dynamic-profile
Browse files Browse the repository at this point in the history
build issue fixes
  • Loading branch information
usama-tariq1 authored Jan 13, 2025
2 parents fde1396 + 04d7752 commit 64ecc03
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/components/Dashboard/profile/edit-profile-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ const EditProfileModal: React.FC = () => {
)
.map((tag) => ({ ...tag, status: TagStatus.saved }))
)
editedBio && setBio(editedBio)
if(editedBio){
setBio(editedBio)
}
setIsOpen(false)
setEditedBio("")
toast({
Expand Down
8 changes: 6 additions & 2 deletions src/components/TagsInput/TagsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ const TagsInput: React.FC<TagsInputProps> = ({

useEffect(() => {
return () => {
timer && clearTimeout(timer.current)
if(timer){
clearTimeout(timer.current)
}
}
}, [])

const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (autocomplete) {
// Clear existing timer
timer && clearTimeout(timer.current)
if(timer){
clearTimeout(timer.current)
}
// Set new timer for debouncing
if (e.target.value.length >= 2) {
timer.current = setTimeout(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/db/data-access/user/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export async function FindUserWildCard(wildcard: string) {
email: true,
external_auth_id: true,
profile_url: true,
unique_id: true
unique_id: true,
bio: true
},
where: (usersTable, { or }) =>
or(
Expand Down
14 changes: 9 additions & 5 deletions src/server-actions/User/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ export const SaveUserProfileAction = CreateServerAction(
)
}
// add existing tags
profileData.existingTags.length &&
(await AddUserTag(
if(profileData.existingTags.length) {
await AddUserTag(
profileData.existingTags.map((tag) => {
return { user_id: profileData.userId, tag_id: tag.id as number }
})
))
)
}

// delete tags
profileData.deletedTagsIds.length &&
(await DeleteUserTags(profileData.userId, profileData.deletedTagsIds))
if(profileData.deletedTagsIds.length){
await DeleteUserTags(profileData.userId, profileData.deletedTagsIds)
}

return {
success: true
}
Expand Down

0 comments on commit 64ecc03

Please sign in to comment.