mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-16 12:23:12 +00:00
chore: fix set state
This commit is contained in:
parent
87d626cd1d
commit
29043f63b6
@ -51,6 +51,13 @@ const CreateCollectionDrawer: React.FC<Props> = (props: Props) => {
|
|||||||
})
|
})
|
||||||
.filter((shortcut) => !selectedShortcuts.find((selectedShortcut) => selectedShortcut.id === shortcut.id));
|
.filter((shortcut) => !selectedShortcuts.find((selectedShortcut) => selectedShortcut.id === shortcut.id));
|
||||||
|
|
||||||
|
const setPartialState = (partialState: Partial<State>) => {
|
||||||
|
setState({
|
||||||
|
...state,
|
||||||
|
...partialState,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) {
|
if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) {
|
||||||
setPartialState({
|
setPartialState({
|
||||||
@ -87,13 +94,6 @@ const CreateCollectionDrawer: React.FC<Props> = (props: Props) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const setPartialState = (partialState: Partial<State>) => {
|
|
||||||
setState({
|
|
||||||
...state,
|
|
||||||
...partialState,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setPartialState({
|
setPartialState({
|
||||||
collectionCreate: Object.assign(state.collectionCreate, {
|
collectionCreate: Object.assign(state.collectionCreate, {
|
||||||
|
@ -59,6 +59,13 @@ const CreateShortcutDrawer: React.FC<Props> = (props: Props) => {
|
|||||||
const loadingState = useLoading(!isCreating);
|
const loadingState = useLoading(!isCreating);
|
||||||
const requestState = useLoading(false);
|
const requestState = useLoading(false);
|
||||||
|
|
||||||
|
const setPartialState = (partialState: Partial<State>) => {
|
||||||
|
setState({
|
||||||
|
...state,
|
||||||
|
...partialState,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) {
|
if (workspaceStore.setting.defaultVisibility !== Visibility.VISIBILITY_UNSPECIFIED) {
|
||||||
setPartialState({
|
setPartialState({
|
||||||
@ -94,13 +101,6 @@ const CreateShortcutDrawer: React.FC<Props> = (props: Props) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const setPartialState = (partialState: Partial<State>) => {
|
|
||||||
setState({
|
|
||||||
...state,
|
|
||||||
...partialState,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleNameInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setPartialState({
|
setPartialState({
|
||||||
shortcutCreate: Object.assign(state.shortcutCreate, {
|
shortcutCreate: Object.assign(state.shortcutCreate, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user