- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2k
 
Fix: Toast disableAnimation Not Respecting Immediate Close #5804
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
base: canary
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -362,6 +362,48 @@ You can customize the `DateRangePicker` component by passing custom Tailwind CSS | |||||
| 
     | 
||||||
| <Spacer y={4} /> | ||||||
| 
     | 
||||||
| ## Troubleshooting | ||||||
| 
     | 
||||||
| ### Common Issues | ||||||
| 
     | 
||||||
| #### onFocusChange only updates start date | ||||||
| When using `onFocusChange` in DateRangePicker, make sure to handle both start and end date focus changes properly: | ||||||
| 
     | 
||||||
| ```jsx | ||||||
| // ❌ Wrong - only updates start date | ||||||
| onFocusChange: (val) => setValue({...value, start: val}), | ||||||
| 
     | 
||||||
| // ✅ Correct - handles both start and end focus | ||||||
| onFocusChange: (val) => { | ||||||
| if (val === "start") { | ||||||
| setValue({...value, start: val}); | ||||||
| } else if (val === "end") { | ||||||
| setValue({...value, end: val}); | ||||||
| } | ||||||
| }, | ||||||
| ``` | ||||||
| 
         
      Comment on lines
    
      +369
     to 
      +384
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation example contains the same logic error as the implementation. The "correct" example shows the same bug present in  Based on React Aria's RangeCalendar API,  Update the documentation to show the correct pattern: -#### onFocusChange only updates start date
-When using `onFocusChange` in DateRangePicker, make sure to handle both start and end date focus changes properly:
-
-```jsx
-// ❌ Wrong - only updates start date
-onFocusChange: (val) => setValue({...value, start: val}),
-
-// ✅ Correct - handles both start and end focus
-onFocusChange: (val) => {
-  if (val === "start") {
-    setValue({...value, start: val});
-  } else if (val === "end") {
-    setValue({...value, end: val});
-  }
-},
-```
+#### onFocusChange receives DateValue, not a focus indicator
+When using `onFocusChange` in RangeCalendar, the callback receives the newly focused `DateValue`:
+
+```jsx
+// ✅ Correct - updates the focused value
+onFocusChange: (val) => {
+  setValue({...value, start: val});
+},
+```
+
+If you need to track whether the start or end field is focused, use `calendarProps.focusedValue` to determine which field should be updated, or manage focus state separately.🤖 Prompt for AI Agents | 
||||||
| 
     | 
||||||
| #### Missing React import | ||||||
| Make sure to import React when using DateRangePicker in your components: | ||||||
| 
     | 
||||||
| ```jsx | ||||||
| import React from "react"; | ||||||
| import {DateRangePicker} from "@heroui/react"; | ||||||
| ``` | ||||||
| 
     | 
||||||
| #### Date range not updating properly | ||||||
| Ensure you're using the correct value structure for date ranges: | ||||||
| 
     | 
||||||
| ```jsx | ||||||
| // ✅ Correct structure | ||||||
| const [value, setValue] = useState({ | ||||||
| start: today(getLocalTimeZone()), | ||||||
| end: today(getLocalTimeZone()).add({days: 7}) | ||||||
| }); | ||||||
| ``` | ||||||
| 
     | 
||||||
| <Spacer y={4} /> | ||||||
| 
     | 
||||||
| ## API | ||||||
| 
     | 
||||||
| ### DateRangePicker Props | ||||||
| 
          
            
          
           | 
    @@ -684,7 +726,7 @@ You can customize the `DateRangePicker` component by passing custom Tailwind CSS | |||||
| { | ||||||
| attribute: "onFocusChange", | ||||||
| type: "(isFocused: boolean) => void", | ||||||
| description: "Handler that is called when the element's focus status changes.", | ||||||
| description: "Handler that is called when the element's focus status changes. **Important**: When using this with DateRangePicker, make sure to handle both start and end date focus changes properly to avoid losing the end date selection.", | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent with the flawed troubleshooting example. The warning about handling both start and end date focus changes aligns with the incorrect troubleshooting example above (lines 377-384), which contains the same logic error as the implementation. Update this description to accurately reflect the correct  -      description: "Handler that is called when the element's focus status changes. **Important**: When using this with DateRangePicker, make sure to handle both start and end date focus changes properly to avoid losing the end date selection.",
+      description: "Handler that is called when the element's focus status changes. The callback receives a `DateValue` representing the newly focused date in the calendar.",📝 Committable suggestion
 
        Suggested change
       
    
 🤖 Prompt for AI Agents | 
||||||
| default: "-" | ||||||
| }, | ||||||
| { | ||||||
| 
          
            
          
           | 
    ||||||
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.
Critical logic error: onFocusChange incorrectly assigns string to date value.
The code checks if
val === "start"orval === "end", but then directly assignsvalto the date fields. This will setvalue.startorvalue.endto the string"start"or"end"instead of a valid date value, breaking the DateRangePicker.Based on React Aria's RangeCalendar API,
onFocusChangereceives aDateValue(the newly focused date), not a focus indicator string. The conditional checks for string equality are incorrect.Apply this diff to fix the logic:
If you need to track which field (start or end) is focused, use a separate state variable or the calendar's built-in focus management rather than inspecting the date value.
🤖 Prompt for AI Agents