[WEB-4834] fix: range date picker weekStartsOn#7699
Conversation
WalkthroughThe DateRangeDropdown component is wrapped with MobX observer, now reads the user profile’s start_of_the_week via useUserProfile, computes startOfWeek, and passes weekStartsOn to the Calendar picker. No other structural changes beyond adjusting the export to observer(...) are included. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant DateRangeDropdown as DateRangeDropdown (observer)
participant UserProfile as User Profile Store
participant Calendar as Calendar UI
User->>DateRangeDropdown: Open dropdown / render
DateRangeDropdown->>UserProfile: Read data.start_of_the_week
UserProfile-->>DateRangeDropdown: startOfWeek
DateRangeDropdown->>Calendar: Render with weekStartsOn = startOfWeek
note over DateRangeDropdown,Calendar: With MobX observer, changes to user profile re-render Calendar with updated week start.
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the range date picker component to respect the user's weekStartsOn preference. The component now retrieves the user's week start preference from their profile and applies it to the calendar component.
- Converts the DateRangeDropdown component to use MobX observer pattern for reactive state management
- Integrates user profile data to retrieve the week start preference
- Passes the
weekStartsOnprop to the Calendar component
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Pull Request Linked with Plane Work Items
Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/web/core/components/dropdowns/date-range.tsx (2)
5-5: Prefer mobx-react-lite for function componentsUse mobx-react-lite to avoid pulling legacy class-based bits and keep bundle lean.
-import { observer } from "mobx-react"; +import { observer } from "mobx-react-lite";
64-64: Type the observer wrapper idiomatically to retain displayName and precise props typingSmall style/tstype improvement.
-export const DateRangeDropdown: React.FC<Props> = observer((props) => { +export const DateRangeDropdown = observer(function DateRangeDropdown(props: Props) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/web/core/components/dropdowns/date-range.tsx(5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/web/core/components/dropdowns/date-range.tsx (1)
apps/space/core/hooks/store/use-user-profile.ts (1)
useUserProfile(7-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: Build and lint web apps
🔇 Additional comments (2)
apps/web/core/components/dropdowns/date-range.tsx (2)
282-282: LGTM: Calendar now honors the user’s week startPassing
weekStartsOnaddresses the reported bug.
100-103: Clamp/map start_of_the_week to 0–6 and support string weekdays
Clamp numeric values to [0,6] and map string names (“sunday”→0, “monday”→1, …) to avoid misconfiguring DayPicker if upstream changes. Confirm whether the store already guarantees a 0–6 integer; if so, you can drop the string branch.
Description
This PR updates the range date picker to respect the user’s
weekStartsOnpreference, ensuring the week now begins according to the user’s chosen setting.Type of Change
Summary by CodeRabbit