-
Notifications
You must be signed in to change notification settings - Fork 1.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
feat(project-tree): persist unfiled #29197
base: master
Are you sure you want to change the base?
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 changes the file system handling to persist unfiled items in the database instead of recalculating them on each tree load.
- Replaced
UnfiledFileFinder
withUnfiledFileSaver
class in/posthog/models/file_system.py
to save items to database rather than just retrieving them - Implemented
_generate_unique_path
method to handle naming collisions when creating file paths - Added database queries with
Exists
andOuterRef
to check if items are already saved before creating new entries - Updated API endpoint in
/posthog/api/file_system.py
to usesave_unfiled_files
instead ofget_unfiled_files
- Added comprehensive tests for idempotency to ensure duplicate entries aren't created when function is called multiple times
4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
Size Change: 0 B Total Size: 9.72 MB ℹ️ View Unchanged
|
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
Problem
We're recalculating the unfiled items every time the tree loads
Changes
Ideally we'd precalculate this for teams (not on first load like now), but this is good enough for testing.
How did you test this code?
Updated tests, clicked around locally.