Merge branch 'fix/widget-loading' into 'release'

Fix components for widget update

See merge request theappsmith/internal-tools-client!275
This commit is contained in:
Hetu Nandu 2020-01-31 11:13:16 +00:00
commit e0aa13b35e
6 changed files with 75 additions and 38 deletions

View File

@ -25,7 +25,13 @@ class DatePickerComponent extends React.Component<DatePickerComponentProps> {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -74,7 +74,13 @@ class DropDownComponent extends React.Component<DropDownComponentProps> {
<DropdownContainer> <DropdownContainer>
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -105,10 +105,14 @@ class InputComponent extends React.Component<
return ( return (
<InputComponentWrapper fill> <InputComponentWrapper fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
<span className={this.props.isLoading ? "bp3-skeleton" : ""}> className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</span>
</Label> </Label>
)} )}

View File

@ -31,7 +31,13 @@ class RadioGroupComponent extends React.Component<RadioGroupComponentProps> {
return ( return (
<StyledControlGroup fill> <StyledControlGroup fill>
{this.props.label && ( {this.props.label && (
<Label className={Classes.TEXT_OVERFLOW_ELLIPSIS}> <Label
className={
this.props.isLoading
? Classes.SKELETON
: Classes.TEXT_OVERFLOW_ELLIPSIS
}
>
{this.props.label} {this.props.label}
</Label> </Label>
)} )}

View File

@ -20,6 +20,7 @@ import React, { useRef, MutableRefObject, useEffect, memo } from "react";
import styled from "constants/DefaultTheme"; import styled from "constants/DefaultTheme";
import { ColumnAction } from "components/propertyControls/ColumnActionSelectorControl"; import { ColumnAction } from "components/propertyControls/ColumnActionSelectorControl";
import { ActionPayload } from "constants/ActionConstants"; import { ActionPayload } from "constants/ActionConstants";
import { Classes } from "@blueprintjs/core";
export interface TableComponentProps { export interface TableComponentProps {
data: object[]; data: object[];
@ -163,6 +164,7 @@ const TableComponent = memo(
} }
return ( return (
<div className={props.isLoading ? Classes.SKELETON : ""}>
<StyledGridComponent <StyledGridComponent
selectionSettings={settings} selectionSettings={settings}
dataSource={props.data} dataSource={props.data}
@ -178,12 +180,19 @@ const TableComponent = memo(
columnDrop={columnDrop} columnDrop={columnDrop}
commandClick={onCommandClick} commandClick={onCommandClick}
columnMenuOpen={columnMenuOpen} columnMenuOpen={columnMenuOpen}
// queryCellInfo={customizeCell}
> >
<Inject services={[Resize, Page, Reorder, ColumnMenu, CommandColumn]} /> <Inject
services={[Resize, Page, Reorder, ColumnMenu, CommandColumn]}
/>
<ColumnsDirective> <ColumnsDirective>
{props.columns.map(col => { {props.columns.map(col => {
return ( return (
<ColumnDirective key={col.field} field={col.field} width={200} /> <ColumnDirective
key={col.field}
field={col.field}
width={200}
/>
); );
})} })}
{commands.length > 0 && ( {commands.length > 0 && (
@ -191,10 +200,12 @@ const TableComponent = memo(
)} )}
</ColumnsDirective> </ColumnsDirective>
</StyledGridComponent> </StyledGridComponent>
</div>
); );
}, },
(prevProps, nextProps) => { (prevProps, nextProps) => {
const propsNotEqual = const propsNotEqual =
nextProps.isLoading !== prevProps.isLoading ||
JSON.stringify(nextProps.data) !== JSON.stringify(prevProps.data) || JSON.stringify(nextProps.data) !== JSON.stringify(prevProps.data) ||
nextProps.height !== prevProps.height || nextProps.height !== prevProps.height ||
JSON.stringify(nextProps.columnActions) !== JSON.stringify(nextProps.columnActions) !==

View File

@ -11,6 +11,7 @@ import {
put, put,
takeEvery, takeEvery,
takeLatest, takeLatest,
take,
} from "redux-saga/effects"; } from "redux-saga/effects";
import { import {
ActionPayload, ActionPayload,
@ -382,7 +383,6 @@ export function* runApiActionSaga(action: ReduxAction<string>) {
function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) { function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) {
const pageActions = action.payload; const pageActions = action.payload;
const apiResponses = yield select(getActionResponses);
const actionPayloads: ActionPayload[][] = pageActions.map(actionSet => const actionPayloads: ActionPayload[][] = pageActions.map(actionSet =>
actionSet.map(action => ({ actionSet.map(action => ({
actionId: action.id, actionId: action.id,
@ -392,10 +392,14 @@ function* executePageLoadActionsSaga(action: ReduxAction<PageAction[][]>) {
})), })),
); );
for (const actionSet of actionPayloads) { for (const actionSet of actionPayloads) {
const apiResponses = yield select(getActionResponses);
const filteredSet = actionSet.filter( const filteredSet = actionSet.filter(
action => !(action.actionId in apiResponses), action => !apiResponses[action.actionId],
); );
yield* executeReduxActionSaga(executeAction(filteredSet)); yield put(executeAction(filteredSet));
for (const {} of filteredSet) {
yield take(ReduxActionTypes.EXECUTE_ACTION_SUCCESS);
}
} }
} }