Fixed DeleteShortUrlModal being removed from the DOM before CSS transition finished

This commit is contained in:
Alejandro Celaya
2022-11-22 19:39:07 +01:00
parent bc2c945fee
commit d21758c410
6 changed files with 36 additions and 23 deletions

View File

@@ -1,9 +1,9 @@
import { createSlice } from '@reduxjs/toolkit';
import { createAction, createSlice } from '@reduxjs/toolkit';
import { createAsyncThunk } from '../../utils/helpers/redux';
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
import { parseApiError } from '../../api/utils';
import { ProblemDetailsError } from '../../api/types/errors';
import { ShortUrlIdentifier } from '../data';
import { ShortUrl, ShortUrlIdentifier } from '../data';
const REDUCER_PREFIX = 'shlink/shortUrlDeletion';
@@ -31,6 +31,8 @@ export const deleteShortUrl = (buildShlinkApiClient: ShlinkApiClientBuilder) =>
},
);
export const shortUrlDeleted = createAction<ShortUrl>(`${REDUCER_PREFIX}/shortUrlDeleted`);
export const shortUrlDeletionReducerCreator = (deleteShortUrlThunk: ReturnType<typeof deleteShortUrl>) => {
const { actions, reducer } = createSlice({
name: REDUCER_PREFIX,

View File

@@ -5,7 +5,7 @@ import { createNewVisits } from '../../visits/reducers/visitCreation';
import { createAsyncThunk } from '../../utils/helpers/redux';
import { ShlinkApiClientBuilder } from '../../api/services/ShlinkApiClientBuilder';
import { ShlinkShortUrlsListParams, ShlinkShortUrlsResponse } from '../../api/types';
import { deleteShortUrl } from './shortUrlDeletion';
import { shortUrlDeleted } from './shortUrlDeletion';
import { createShortUrl } from './shortUrlCreation';
import { editShortUrl } from './shortUrlEdition';
import { ShortUrl } from '../data';
@@ -36,7 +36,6 @@ export const shortUrlsListReducerCreator = (
listShortUrlsThunk: ReturnType<typeof listShortUrls>,
editShortUrlThunk: ReturnType<typeof editShortUrl>,
createShortUrlThunk: ReturnType<typeof createShortUrl>,
deleteShortUrlThunk: ReturnType<typeof deleteShortUrl>,
) => createSlice({
name: REDUCER_PREFIX,
initialState,
@@ -81,7 +80,7 @@ export const shortUrlsListReducerCreator = (
);
builder.addCase(
deleteShortUrlThunk.fulfilled,
shortUrlDeleted,
pipe(
(state, { payload }) => (!state.shortUrls ? state : assocPath(
['shortUrls', 'data'],