mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
apply suggestion
This commit is contained in:
parent
1ac97c878a
commit
f40c565e4a
12 changed files with 70 additions and 68 deletions
|
@ -1,14 +1,13 @@
|
|||
import React, { FC, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import AlphaPicker from '../../components/alphaPicker/alphaPicker';
|
||||
import { AlphaPickerValueI, QueryI } from './interface';
|
||||
import { QueryI } from './interface';
|
||||
|
||||
interface AlphaPickerContainerI {
|
||||
getQuery: () => QueryI
|
||||
setAlphaPickerValue: React.Dispatch<AlphaPickerValueI>;
|
||||
setStartIndex: React.Dispatch<React.SetStateAction<number>>;
|
||||
interface AlphaPickerContainerProps {
|
||||
getQuery: () => QueryI;
|
||||
setQuery: React.Dispatch<React.SetStateAction<QueryI>>;
|
||||
}
|
||||
|
||||
const AlphaPickerContainer: FC<AlphaPickerContainerI> = ({ getQuery, setAlphaPickerValue, setStartIndex }) => {
|
||||
const AlphaPickerContainer: FC<AlphaPickerContainerProps> = ({ getQuery, setQuery }) => {
|
||||
const [ alphaPicker, setAlphaPicker ] = useState<AlphaPicker>();
|
||||
const element = useRef<HTMLDivElement>(null);
|
||||
const query = getQuery();
|
||||
|
@ -23,9 +22,9 @@ const AlphaPickerContainer: FC<AlphaPickerContainerI> = ({ getQuery, setAlphaPic
|
|||
} else {
|
||||
updatedValue = {NameStartsWith: newValue};
|
||||
}
|
||||
setAlphaPickerValue(updatedValue);
|
||||
setStartIndex(0);
|
||||
}, [setStartIndex, setAlphaPickerValue]);
|
||||
|
||||
setQuery({StartIndex: 0, ...updatedValue});
|
||||
}, [setQuery]);
|
||||
|
||||
useEffect(() => {
|
||||
const alphaPickerElement = element.current;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue