Lib: Don't cache driver dropdown options
This commit is contained in:
@ -32,16 +32,12 @@ export const team_dropdown_options = (teams: Team[]): DropdownOption[] => {
|
|||||||
return team_dropdown_opts;
|
return team_dropdown_opts;
|
||||||
};
|
};
|
||||||
|
|
||||||
let driver_dropdown_opts: DropdownOption[] | null = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a list of [DropdownOptions] for a <Dropdown> component.
|
* Generates a list of [DropdownOptions] for a <Dropdown> component.
|
||||||
* Cached until page reload.
|
* Not cached, because drivers are often filtered by active/inactive.
|
||||||
*/
|
*/
|
||||||
export const driver_dropdown_options = (drivers: Driver[]): DropdownOption[] => {
|
export const driver_dropdown_options = (drivers: Driver[]): DropdownOption[] => {
|
||||||
if (!driver_dropdown_opts) {
|
return drivers.map((driver: Driver) => {
|
||||||
console.log("driver_dropdown_options");
|
|
||||||
driver_dropdown_opts = drivers.map((driver: Driver) => {
|
|
||||||
return {
|
return {
|
||||||
label: driver.code,
|
label: driver.code,
|
||||||
value: driver.id,
|
value: driver.id,
|
||||||
@ -50,9 +46,6 @@ export const driver_dropdown_options = (drivers: Driver[]): DropdownOption[] =>
|
|||||||
icon_height: DRIVER_HEADSHOT_HEIGHT,
|
icon_height: DRIVER_HEADSHOT_HEIGHT,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return driver_dropdown_opts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let race_dropdown_opts: DropdownOption[] | null = null;
|
let race_dropdown_opts: DropdownOption[] | null = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user