mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix: tests and the timezone to not refetch on every timezone change
This commit is contained in:
parent
4f704ef91f
commit
988117d511
2 changed files with 12 additions and 5 deletions
|
|
@ -856,7 +856,7 @@ describe("UsagePage", () => {
|
|||
expect.any(Date),
|
||||
expect.any(Date),
|
||||
"user-123",
|
||||
0,
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -937,7 +937,7 @@ describe("UsagePage", () => {
|
|||
expect.any(Date),
|
||||
1,
|
||||
null,
|
||||
0,
|
||||
expect.any(Number),
|
||||
);
|
||||
|
||||
// Verify second page call
|
||||
|
|
@ -947,7 +947,7 @@ describe("UsagePage", () => {
|
|||
expect.any(Date),
|
||||
2,
|
||||
null,
|
||||
0,
|
||||
expect.any(Number),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ const AdvancedDatePicker: React.FC<AdvancedDatePickerProps> = ({
|
|||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [tempValue, setTempValue] = useState<DateRangePickerValue>(value);
|
||||
const [tempTimezone, setTempTimezone] = useState<number | undefined>(timezoneOffset);
|
||||
const [selectedOption, setSelectedOption] = useState<string | null>(null);
|
||||
|
||||
// Custom date inputs only - removed time inputs
|
||||
|
|
@ -294,6 +295,11 @@ const AdvancedDatePicker: React.FC<AdvancedDatePickerProps> = ({
|
|||
|
||||
const handleApply = () => {
|
||||
if (tempValue.from && tempValue.to && validation.isValid) {
|
||||
// Commit timezone change on Apply, not on every dropdown selection
|
||||
if (onTimezoneChange && tempTimezone !== undefined) {
|
||||
onTimezoneChange(tempTimezone);
|
||||
}
|
||||
|
||||
// First call with immediate value for UI responsiveness
|
||||
onValueChange(tempValue);
|
||||
|
||||
|
|
@ -313,6 +319,7 @@ const AdvancedDatePicker: React.FC<AdvancedDatePickerProps> = ({
|
|||
const handleCancel = () => {
|
||||
// Reset to original value
|
||||
setTempValue(value);
|
||||
setTempTimezone(timezoneOffset);
|
||||
|
||||
// Reset form inputs
|
||||
if (value.from) {
|
||||
|
|
@ -406,8 +413,8 @@ const AdvancedDatePicker: React.FC<AdvancedDatePickerProps> = ({
|
|||
<label className="text-sm text-gray-700 mb-1 block">Timezone</label>
|
||||
<Select
|
||||
showSearch
|
||||
value={timezoneOffset !== undefined ? timezoneOffset : getLocalTimezoneOffset()}
|
||||
onChange={(val) => onTimezoneChange(val)}
|
||||
value={tempTimezone !== undefined ? tempTimezone : getLocalTimezoneOffset()}
|
||||
onChange={(val) => setTempTimezone(val)}
|
||||
options={timezoneOptions}
|
||||
popupMatchSelectWidth={false}
|
||||
listHeight={200}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue