Move TIME_OPTIONS outside component
- TIME_OPTIONS is now computed at module level, not inside component - generateTimeOptions now accepts slotDurationMinutes as parameter - Prevents unnecessary recomputation on every render
This commit is contained in:
parent
02212ba478
commit
40b193238e
1 changed files with 3 additions and 2 deletions
|
|
@ -29,7 +29,8 @@ function getDateRange(): Date[] {
|
|||
}
|
||||
|
||||
// Generate time options for dropdowns (15-min intervals)
|
||||
function generateTimeOptions(): string[] {
|
||||
// Moved outside component since slotDurationMinutes is a constant
|
||||
function generateTimeOptions(slotDurationMinutes: number): string[] {
|
||||
const options: string[] = [];
|
||||
for (let h = 0; h < 24; h++) {
|
||||
for (let m = 0; m < 60; m += slotDurationMinutes) {
|
||||
|
|
@ -41,7 +42,7 @@ function generateTimeOptions(): string[] {
|
|||
return options;
|
||||
}
|
||||
|
||||
const TIME_OPTIONS = generateTimeOptions();
|
||||
const TIME_OPTIONS = generateTimeOptions(slotDurationMinutes);
|
||||
|
||||
interface EditSlot {
|
||||
start_time: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue