-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix login issue #9012
Fix login issue #9012
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR addresses login issues by enhancing validation and authentication flows across the frontend and backend components.
- Improved object metadata loading with new hooks
useLoadMockedObjectMetadataItems
anduseRefreshObjectMetadataItems
in/packages/twenty-front/src/modules/object-metadata/hooks/
- Enhanced logo URL validation using
isNonEmptyString
instead ofisDefined
in/packages/twenty-front/src/modules/auth/components/Logo.tsx
andImageInput.tsx
- Added token-based authentication for workspace logos in
/packages/twenty-server/src/engine/core-modules/workspace/workspace.resolver.ts
- Modified environment variable handling in
vite.config.ts
to use_env_
instead ofprocess.env
- Added validation in
RecordActionMenuEntriesSetter.tsx
to prevent null reference errors with object metadata
10 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile
import { useFindManyObjectMetadataItems } from '@/object-metadata/hooks/useFindManyObjectMetadataItems'; | ||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; | ||
import { useLoadMockedObjectMetadataItems } from '@/object-metadata/hooks/useLoadMockedObjectMetadataItems'; | ||
import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItem'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: typo in import path - 'useRefreshObjectMetadataItem' should be 'useRefreshObjectMetadataItems' to match the actual hook name
) { | ||
loadMockedObjectMetadataItems(); | ||
} else { | ||
refreshObjectMetadataItems(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: refreshObjectMetadataItems is an async function but the await is missing here
const primaryLogoUrl = getImageAbsoluteURI( | ||
props.primaryLogo ?? defaultPrimaryLogoUrl, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: check if primaryLogo could also be an empty string - may need similar validation
snapshot.getLoadable(objectMetadataItemsState).getValue(), | ||
generatedMockObjectMetadataItems, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: getLoadable().getValue() may throw if atom is in error state. Consider using try/catch.
const result = await client.query<ObjectMetadataItemsQuery>({ | ||
query: FIND_MANY_OBJECT_METADATA_ITEMS, | ||
variables: {}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Missing error handling for failed GraphQL queries. Add try/catch block.
const result = await client.query<ObjectMetadataItemsQuery>({ | ||
query: FIND_MANY_OBJECT_METADATA_ITEMS, | ||
variables: {}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding fetchPolicy to prevent stale cache data during refresh
|
||
const objectMetadataItems = | ||
mapPaginatedObjectMetadataItemsToObjectMetadataItems({ | ||
pagedObjectMetadataItems: result.data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: result.data could be undefined here, causing runtime error
@@ -27,6 +27,7 @@ export class FileController { | |||
@Req() req: Request, | |||
) { | |||
const folderPath = checkFilePath(params[0]); | |||
|
|||
const filename = checkFilename(params['filename']); | |||
|
|||
const workspaceId = (req as any)?.workspaceId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Unsafe type assertion. Consider proper typing of the Request object or middleware to ensure workspaceId exists
} catch (e) { | ||
workspaceLogoWithToken = workspace.logo; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider logging the error before falling back to raw logo URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.