-
Notifications
You must be signed in to change notification settings - Fork 2.1k
My docs cleanup #4519
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
My docs cleanup #4519
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
285aba3
to
ca89806
Compare
abe9e59
to
27b9456
Compare
8bb0e81
to
d3540aa
Compare
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
Based on the provided changes, here is a concise summary of the key modifications in this pull request:
The PR primarily focuses on cleanup and UI improvements across the codebase, with some functional changes to persona management and tenant provisioning.
Key changes:
- Improved tenant provisioning by renaming Redis lock to
CLOUD_PRE_PROVISION_TENANT_LOCK
and adding proper cloud task scheduling - Enhanced persona privacy management by adding
creator_user_id
parameter to prevent unnecessary notifications - Streamlined file/folder management in MyDocuments components by removing unused move/rename functionality and improving mobile responsiveness
- Added dark mode support and mobile-friendly styling across multiple components
- Fixed potential redirect loops in authentication flow by adding source tracking
The changes appear focused on improving code organization and user experience while maintaining core functionality. However, some areas need attention:
- The removal of forgot password functionality in cloud mode needs documentation explaining the rationale
- The LaTeX content processing changes should be tested thoroughly
- The Modal overflow change from 'auto' to 'visible' could cause layout issues
56 file(s) reviewed, 29 comment(s)
Edit PR Review Bot Settings | Greptile
if user_id != creator_user_id: | ||
create_notification( | ||
user_id=user_id, | ||
notif_type=NotificationType.PERSONA_SHARED, | ||
db_session=db_session, | ||
additional_data=PersonaSharedNotificationData( | ||
persona_id=persona_id, | ||
).model_dump(), | ||
) |
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: Notification check correctly prevents sending to creator, but should also check if creator_user_id is None to avoid potential false negatives
if user_id != creator_user_id: | |
create_notification( | |
user_id=user_id, | |
notif_type=NotificationType.PERSONA_SHARED, | |
db_session=db_session, | |
additional_data=PersonaSharedNotificationData( | |
persona_id=persona_id, | |
).model_dump(), | |
) | |
if creator_user_id is not None and user_id != creator_user_id: | |
create_notification( | |
user_id=user_id, | |
notif_type=NotificationType.PERSONA_SHARED, | |
db_session=db_session, | |
additional_data=PersonaSharedNotificationData( | |
persona_id=persona_id, | |
).model_dump(), | |
) |
MONITOR_BACKGROUND_PROCESSES_LOCK = "da_lock:monitor_background_processes" | ||
CHECK_AVAILABLE_TENANTS_LOCK = "da_lock:check_available_tenants" | ||
PRE_PROVISION_TENANT_LOCK = "da_lock:pre_provision_tenant" | ||
CLOUD_PRE_PROVISION_TENANT_LOCK = "da_lock:pre_provision_tenant" |
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: The lock name string value remains unchanged despite the constant being renamed to include 'CLOUD_'. Consider updating the string value to also include 'cloud_' for consistency.
folders = ( | ||
db_session.query(UserFolder) | ||
.filter( | ||
(UserFolder.user_id == user_id) | (UserFolder.id == RECENT_DOCS_FOLDER_ID) |
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: Potential security issue: RECENT_DOCS_FOLDER_ID is used before being defined (line 144). Move constant definition to top of file.
folder_snapshot.files = [ | ||
file for file in folder_snapshot.files if file.user_id == user_id | ||
] |
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: Performance concern: filtering files in memory instead of in the database query. Consider adding user_id filter to the initial query.
def get_current_tenant_id() -> str: | ||
tenant_id = CURRENT_TENANT_ID_CONTEXTVAR.get() | ||
if tenant_id is None: | ||
import traceback |
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: importing traceback inside function scope - consider moving to top-level imports for better performance and readability
<div className="hidden sm:block relative w-24 h-2 bg-neutral-200 dark:bg-neutral-700 rounded-full overflow-hidden"> | ||
<div | ||
className={`absolute top-0 left-0 h-full rounded-full ${ | ||
className={` absolute top-0 left-0 h-full rounded-full ${ |
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: Extra space at start of className template literal is unnecessary
// Log render count on each render | ||
useEffect(() => { | ||
setRenderCount((prevCount) => prevCount + 1); | ||
console.log(`TextView component rendered ${renderCount + 1} times`); | ||
}, []); |
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: This effect creates unnecessary re-renders and console spam. Remove the render count tracking as it serves no production purpose and impacts performance.
// Log render count on each render | |
useEffect(() => { | |
setRenderCount((prevCount) => prevCount + 1); | |
console.log(`TextView component rendered ${renderCount + 1} times`); | |
}, []); |
useEffect(() => { | ||
fetchFile(); | ||
}, [fetchFile]); | ||
}, []); |
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: Empty dependency array but using fetchFile callback - this will use stale closure. Should include [fetchFile] in dependencies.
useEffect(() => { | |
fetchFile(); | |
}, [fetchFile]); | |
}, []); | |
useEffect(() => { | |
fetchFile(); | |
}, [fetchFile]); |
}; | ||
|
||
const fetchFile = useCallback(async () => { | ||
console.log("fetching file"); |
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: Remove debug console.log statements before merging to production
|
||
return ( | ||
<div> | ||
<div className="b"> |
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: The 'b' class name appears to be a typo or undefined class. Consider using a more descriptive class name or removing if unnecessary.
<div className="b"> | |
<div> |
* update * improved my docs * nit * nit * k * push changes * update * looking good * k * fix preprocessing * try a fix * k * update * nit * k * quick nits * Cleanup / fixes * Fixes * Fix build * fix * fix quality checks --------- Co-authored-by: Weves <chrisweaver101@gmail.com>
* update * improved my docs * nit * nit * k * push changes * update * looking good * k * fix preprocessing * try a fix * k * update * nit * k * quick nits * Cleanup / fixes * Fixes * Fix build * fix * fix quality checks --------- Co-authored-by: Weves <chrisweaver101@gmail.com>
Description
Fixes https://linear.app/danswer/issue/DAN-1907/get-my-docs-cleanup-in
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.