Blueprints: Fix list of blueprint being replaced by empty state
Search input and list of blueprints could be previously temporarily replaced by an empty state. How to reproduce previous behaviour: 1. start with some created blueprints 2. search for an existing blueprint 3. delete it 4. remove searchTerm from the blueprint search input Before: the blueprint list and blueprint search input are temporarily replaced by an empty state, until re-fetch. After: the list and search input persist throughout blueprint deletion and get replaced by an empty state only when there are no other blueprints
This commit is contained in:
parent
49162e01f5
commit
1d8067f1b0
1 changed files with 13 additions and 3 deletions
|
|
@ -59,7 +59,11 @@ const BlueprintsSidebar = () => {
|
|||
const blueprintSearchInput = useAppSelector(selectBlueprintSearchInput);
|
||||
const blueprintsOffset = useAppSelector(selectOffset);
|
||||
const blueprintsLimit = useAppSelector(selectLimit);
|
||||
const { data: blueprintsData, isLoading } = useGetBlueprintsQuery({
|
||||
const {
|
||||
data: blueprintsData,
|
||||
isLoading,
|
||||
isFetching,
|
||||
} = useGetBlueprintsQuery({
|
||||
search: blueprintSearchInput,
|
||||
limit: blueprintsLimit,
|
||||
offset: blueprintsOffset,
|
||||
|
|
@ -77,7 +81,11 @@ const BlueprintsSidebar = () => {
|
|||
);
|
||||
}
|
||||
|
||||
if (blueprintsTotal === 0 && blueprintSearchInput === undefined) {
|
||||
if (
|
||||
blueprintsTotal === 0 &&
|
||||
blueprintSearchInput === undefined &&
|
||||
!isFetching
|
||||
) {
|
||||
return (
|
||||
<EmptyBlueprintState
|
||||
icon={PlusCircleIcon}
|
||||
|
|
@ -103,7 +111,9 @@ const BlueprintsSidebar = () => {
|
|||
return (
|
||||
<>
|
||||
<Stack hasGutter>
|
||||
{(blueprintsTotal > 0 || blueprintSearchInput !== undefined) && (
|
||||
{(blueprintsTotal > 0 ||
|
||||
blueprintSearchInput !== undefined ||
|
||||
isFetching) && (
|
||||
<>
|
||||
<StackItem>
|
||||
<BlueprintSearch blueprintsTotal={blueprintsTotal} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue