Conversation
- Introduced a new migration for seeding demo data for first-time users, including events and tasks with sensible defaults. - Updated storage migration tests to accommodate new localStorage keys and ensure proper handling of migration flags. - Added comprehensive tests for the demo data seed migration to verify correct data population and behavior under various conditions. - Refactored existing migration tests to improve clarity and maintainability.
- Eliminated the createDefaultSomedays method from EventService to streamline event management. - Updated UserService to remove calls to createDefaultSomedays during user initialization, focusing on priority creation instead. - Adjusted related tests to reflect the removal of default someday events, ensuring consistency in user data setup.
…etup - Added a new utility function, prepareEmptyStorageForTests, to streamline the test setup process by clearing localStorage and IndexedDB, and setting a migration flag to prevent demo data seeding. - Updated multiple test files to utilize this new utility, enhancing consistency and reducing redundancy in test initialization. - Refactored existing tests to ensure they correctly prepare the storage state before each test, improving reliability and maintainability.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements demo data seeding for first-time users to improve onboarding, addressing issue #1444. Instead of showing an empty interface, new users now see pre-populated tasks and events with helpful instructions on using the app.
Changes:
- Added a migration-based demo data seeding system that populates sample events and tasks for first-time users
- Moved default someday event creation from backend to frontend (web package)
- Created a test utility (
prepareEmptyStorageForTests) to prevent demo data seeding during tests
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web/src/common/storage/migrations/external/demo-data-seed.ts | New migration that seeds demo data (events and tasks) for first-time users with relative dates |
| packages/web/src/common/storage/migrations/external/demo-data-seed.test.ts | Comprehensive tests for demo data seeding migration |
| packages/web/src/common/storage/migrations/migrations.ts | Registers the new demo data seed migration |
| packages/web/src/common/storage/migrations/migrations.test.ts | Updates migration tests to handle the new demo data seed flag |
| packages/web/src/tests/utils/storage/indexeddb.test.util.ts | Adds prepareEmptyStorageForTests utility to clear storage and prevent demo seeding in tests |
| packages/web/src/views/Day/view/DayViewContent.test.tsx | Updates to use new test utility and refactors task addition helper |
| packages/web/src/views/Day/context/tests/TaskContext.test.tsx | Updates to use new test utility |
| packages/web/src/views/Day/components/Tasks/Tasks.test.tsx | Updates to use new test utility |
| packages/web/src/views/Day/components/ContextMenu/TaskContextMenu.test.tsx | Updates to use new test utility and adds test timeout |
| packages/web/src/common/utils/shortcut/shortcut.util.tsx | Adds getModifierKeyLabel function for user-friendly modifier key display |
| packages/web/src/index.tsx | Adds console.debug statement (appears unrelated to PR purpose) |
| packages/backend/src/user/services/user.service.ts | Removes backend default someday events creation |
| packages/backend/src/user/services/user.service.test.ts | Updates tests to reflect removed backend someday events |
| packages/backend/src/event/services/event.service.ts | Removes createDefaultSomedays method |
packages/web/src/views/Day/components/ContextMenu/TaskContextMenu.test.tsx
Outdated
Show resolved
Hide resolved
packages/web/src/common/storage/migrations/external/demo-data-seed.ts
Outdated
Show resolved
Hide resolved
…djust event counts - Added an all-day event titled "Deep work day" to the demo data seed, enhancing the variety of events generated for testing. - Updated the expected event count in tests to reflect the addition of the new all-day event, ensuring accurate verification of event creation. - Adjusted documentation to clarify the changes in the demo data structure, including the new all-day event and updated counts for today’s events.
- Removed detailed descriptions of demo data contents from the migration documentation to streamline the information presented. - Updated the demo data seed migration to maintain clarity while focusing on essential details for first-time users.
…ag updates - Introduced a new utility function, createMockStorageAdapter, to streamline the creation of mock storage adapters for testing. - Updated existing tests to utilize the new mock adapter, improving consistency and reducing redundancy in test setup. - Refactored migration tests to replace hardcoded migration flag keys with the new DEMO_DATA_SEED_FLAG_KEY, ensuring clarity and maintainability. - Enhanced the demo data seed migration to utilize the updated flag key, aligning with recent changes in the storage architecture.
…data seed - Introduced a new test case to verify the creation of timed events with 15-minute-aligned times in RFC3339 offset format, ensuring no seconds or milliseconds are included. - Updated the demo data generation logic to align with the new event format, enhancing the consistency and accuracy of the demo data for testing purposes. - Adjusted existing event creation functions to ensure proper handling of time formatting, improving overall data integrity.
- Added `isAllDay` and `isSomeday` properties to multiple events in the demo data seed, ensuring more accurate representation of event types. - Renamed an event from "Catch up with a friend" to "Call a friend" and added a description for clarity. - Updated the demo data generation logic to improve the variety and detail of events for testing purposes.
…imed events - Added a new test case to verify that default grid position data is correctly added to seeded timed events, ensuring proper layout handling. - Updated the demo data generation logic to include grid event assembly for timed events, improving the accuracy of event positioning in the demo data. - Enhanced existing event descriptions to provide more context for testing scenarios.
- Added a new test case to ensure seeded events conform to their respective schemas, validating both grid and core event structures. - Updated the demo data generation logic to include position data for timed events, improving layout accuracy in the demo data. - Enhanced event descriptions for clarity in testing scenarios, ensuring better context for validation checks.
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.
closes #1444 and #1128