这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class TodoInput extends React.Component {

handleTextboxValueChange(e) {
this.setState({
...this.state,
textboxValue: e.target.value
});
}
Expand Down Expand Up @@ -60,7 +59,6 @@ class TodoInput extends React.Component {
console.error(e);
}
this.setState({
...this.state,
textboxValue: ""
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class TodoPublicList extends Component {
next(data) {
if (data.data.todos.length) {
_this.setState({
...this.state,
showNew: true,
newTodosLength:
_this.state.newTodosLength + data.data.todos.length
Expand All @@ -69,7 +68,7 @@ class TodoPublicList extends Component {
}
loadMoreClicked() {
const { client } = this.props;
this.setState({ ...this.state, showNew: false, newTodosLength: 0 });
this.setState({ showNew: false, newTodosLength: 0 });
client
.query({
query: QUERY_FEED_PUBLIC_TODO,
Expand All @@ -81,7 +80,7 @@ class TodoPublicList extends Component {
if (data.data.todos.length) {
const mergedTodos = data.data.todos.concat(this.state.todos);
// update state with new todos
this.setState({ ...this.state, todos: mergedTodos });
this.setState({ todos: mergedTodos });
}
});
}
Expand All @@ -100,17 +99,17 @@ class TodoPublicList extends Component {
if (data.data.todos.length) {
const mergedTodos = this.state.todos.concat(data.data.todos);
// update state with new todos
this.setState({ ...this.state, todos: mergedTodos });
this.setState({ todos: mergedTodos });
} else {
this.setState({ ...this.state, showOlder: false });
this.setState({ showOlder: false });
}
});
}
deletePublicTodoClicked(deletedTodo) {
const finalTodos = this.state.todos.filter(t => {
return t.id !== deletedTodo.id;
});
this.setState({ ...this.state, todos: finalTodos });
this.setState({ todos: finalTodos });
}
completePublicTodoClicked(completedTodo) {
const finalTodos = this.state.todos.filter(t => {
Expand All @@ -120,7 +119,7 @@ class TodoPublicList extends Component {
}
return t;
});
this.setState({ ...this.state, todos: finalTodos });
this.setState({ todos: finalTodos });
}
render() {
const { userId, type } = this.props;
Expand Down
1 change: 0 additions & 1 deletion community/sample-apps/realtime-chat/src/components/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Chat extends React.Component {
// set refetch function (coming from child <Query> component) using callback
setRefetch = (refetch) => {
this.setState({
...this.state,
refetch
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default class RenderMessagesProxy extends React.Component {
// Set mutation callback. For instantly adding messages to state after mutation
setMutationCallback = (mutationCallback) => {
this.setState({
...this.state,
mutationCallback
})
}
Expand Down
2 changes: 0 additions & 2 deletions community/sample-apps/realtime-chat/src/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ export default class Main extends React.Component {
// set username
setUsername = (username) => {
this.setState({
...this.state,
username
})
}

// check usernme and perform login
login = (id) => {
this.setState({
...this.state,
isLoggedIn: true,
userId: id
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class OnlineUsers extends React.Component {

toggleMobileView = () => {
this.setState({
...this.state,
showMobileView: !this.state.showMobileView
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export default class RenderMessages extends React.Component {
}
});
this.setState({
...this.state,
newMessages
})
}
Expand All @@ -104,7 +103,6 @@ export default class RenderMessages extends React.Component {
addOldMessages = (messages) => {
const oldMessages = [ ...this.state.messages, ...messages];
this.setState({
...this.state,
messages: oldMessages,
newMessages: []
})
Expand All @@ -115,7 +113,6 @@ export default class RenderMessages extends React.Component {
const messages = [ ...this.state.messages, ...this.state.newMessages ];
messages.push(message);
this.setState({
...this.state,
messages,
newMessages: []
});
Expand Down Expand Up @@ -158,13 +155,11 @@ export default class RenderMessages extends React.Component {
const windowBottom = windowHeight + window.pageYOffset;
if (windowBottom >= docHeight) {
this.setState({
...this.state,
bottom: true
})
} else {
if (this.state.bottom) {
this.setState({
...this.state,
bottom: false
});
}
Expand Down Expand Up @@ -211,7 +206,6 @@ export default class RenderMessages extends React.Component {
// set refetch in local state to make a custom refetch
if (!this.state.refetch) {
this.setState({
...this.state,
refetch
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class App extends Component {
}
componentWillReceiveProps(nextProps) {
if ( nextProps.vehicleId !== this.props.vehicleId ) {
this.setState({ ...this.state, vehicleId: nextProps.vehicleId });
this.setState({ vehicleId: nextProps.vehicleId });
}
}
render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MapContainer extends Component {
}
}
handleGoogleMapApi = (google) => {
this.setState({ ...this.state, ...google, mapLoaded: true});
this.setState({ ...google, mapLoaded: true});
const getPolyline = (routeJson) => {
var polyline = new google.maps.Polyline({
path: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Vehicle extends Component { constructor() {
}
updateLocation() {
if (locationData.length === this.state.locationId) {
this.setState({ ...this.state, locationId: 0 });
this.setState({ locationId: 0 });
}
const insert_vehicle_location = gql`
mutation insert_vehicle_location ($objects: [vehicle_location_insert_input!]! ) {
Expand All @@ -52,19 +52,19 @@ class Vehicle extends Component { constructor() {
variables: { ...variables },
}
).then((response) => {
this.setState({ ...this.state, locationId: this.state.locationId + 1});
this.setState({ locationId: this.state.locationId + 1});

})
.catch((error) => console.error(error));
}
loadVehicleInfo(e) {
const vehicleId = e.target.getAttribute('data-vehicle-id');
if ( vehicleId ){
this.setState({ ...this.state, vehicleId: parseInt(vehicleId, 10)});
this.setState({ vehicleId: parseInt(vehicleId, 10)});
}
}
handleTrackLocationClick() {
this.setState({ ...this.state, isLoading: true });
this.setState({ isLoading: true });
const insert_vehicle = gql`
mutation insert_vehicle ($objects: [vehicle_insert_input!]! ) {
insert_vehicle (objects: $objects){
Expand All @@ -88,11 +88,11 @@ class Vehicle extends Component { constructor() {
variables: { ...variables },
}
).then((response) => {
this.setState({ ...this.state, startTracking: true });
this.setState({ startTracking: true });
const pollId = setInterval(this.updateLocation.bind(this), this.state.delay);
this.setState({ ...this.state, pollId: pollId, isLoading: false });
this.setState({ pollId: pollId, isLoading: false });
}).catch((error) => {
this.setState({ ...this.state, isLoading: false });
this.setState({ isLoading: false });
console.error(error)
});
}
Expand Down
12 changes: 6 additions & 6 deletions community/sample-apps/realtime-poll/src/Poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ class PollQuestion extends Component {
}

handleOptionChange = (e) => {
this.setState({ ...this.state, optionId: e.currentTarget.value });
this.setState({ optionId: e.currentTarget.value });
}

onMutationCompleted = () => {
this.setState({ ...this.state, voteBtnText: '👍 Done', voteBtnStyle: 'success' });
this.setState({ voteBtnText: '👍 Done', voteBtnStyle: 'success' });
window.setTimeout(() => {
this.setState({ ...this.state, voteBtnText: '🗳️ Vote', voteBtnStyle: 'primary' });
this.setState({ voteBtnText: '🗳️ Vote', voteBtnStyle: 'primary' });
}, 3000);
}

onMutationError = () => {
this.setState({ ...this.state, voteBtnText: 'Error 😞 Try again', voteBtnStyle: 'danger' });
this.setState({ voteBtnText: 'Error 😞 Try again', voteBtnStyle: 'danger' });
}

render () {
Expand All @@ -52,10 +52,10 @@ class PollQuestion extends Component {
onSubmit={e => {
e.preventDefault();
if (!this.state.optionId) {
this.setState({...this.state, voteBtnText: '✋ Select an option and try again', voteBtnStyle: 'warning'});
this.setState({ voteBtnText: '✋ Select an option and try again', voteBtnStyle: 'warning'});
return
}
this.setState({...this.state, voteBtnText: '🗳️ Submitting', voteBtnStyle: 'info'});
this.setState({ voteBtnText: '🗳️ Submitting', voteBtnStyle: 'info'});
vote({
variables: {
optionId: this.state.optionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default class TodoInput extends React.Component {

handleTextboxValueChange = (e) => {
this.setState({
...this.state,
textboxValue: e.target.value
});
}
Expand All @@ -44,7 +43,6 @@ export default class TodoInput extends React.Component {
data
})
this.setState({
...this.state,
textboxValue: ''
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GraphiQLWrapper extends Component {
: null;
if (queryFile) {
getRemoteQueries(queryFile, queries =>
this.setState({ ...this.state, queries })
this.setState({ queries })
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LoginComponent extends React.Component {
this.state = { graphqlEndpoint: '' };
}
setGraphQLEndpoint(e) {
this.setState({ ...this.state, graphqlEndpoint: e.target.value });
this.setState({ graphqlEndpoint: e.target.value });
}
render() {
const { dispatch } = this.props;
Expand Down
6 changes: 1 addition & 5 deletions console/src/components/ApiExplorer/GraphiQLWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ class GraphiQLWrapper extends Component {
? this.props.queryParams.query_file
: null;
if (queryFile) {
getRemoteQueries(queryFile, queries =>
this.setState({ ...this.state, queries })
);
getRemoteQueries(queryFile, queries => this.setState({ queries }));
}
}

Expand Down Expand Up @@ -83,13 +81,11 @@ class GraphiQLWrapper extends Component {
}
updateAnalyzeState(supportAnalyze) {
this.setState({
...this.state,
supportAnalyze: supportAnalyze,
});
}
updateAnalyzeApiState(analyzeApiChange) {
this.setState({
...this.state,
analyzeApiChange: analyzeApiChange,
});
}
Expand Down
3 changes: 0 additions & 3 deletions console/src/components/Common/InputChecker/InputChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default class InputChecker extends React.Component {
e.target && parseInt(e.target.getAttribute('data-index-id'), 10);
if (!val) {
this.setState({
...this.state,
isError: false,
errorMessage: '',
});
Expand All @@ -26,15 +25,13 @@ export default class InputChecker extends React.Component {
inputChecker(this.props.type, val)
.then(r => {
this.setState({
...this.state,
isError: false,
errorMessage: '',
});
this.props.onBlur(undefined, indexId, r);
})
.catch(r => {
this.setState({
...this.state,
isError: true,
errorMessage: r.message,
});
Expand Down
3 changes: 1 addition & 2 deletions console/src/components/Main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Main extends React.Component {
this.props.serverVersion
);
if (showSchemaStitch) {
this.setState({ ...this.state, showSchemaStitch: true });
this.setState({ showSchemaStitch: true });
}
return Promise.resolve();
}
Expand Down Expand Up @@ -97,7 +97,6 @@ class Main extends React.Component {
};
setLoveConsentState(s);
this.setState({
...this.state,
loveConsentState: { ...getLoveConsentState() },
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Edit extends React.Component {
}
}
updateDeleteConfirmationError(data) {
this.setState({ ...this.state, deleteConfirmationError: data });
this.setState({ deleteConfirmationError: data });
}
modifyClick() {
this.props.dispatch({ type: TOGGLE_MODIFY });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ModifyCustomFunction extends React.Component {
]);
}
updateDeleteConfirmationError(data) {
this.setState({ ...this.state, deleteConfirmationError: data });
this.setState({ deleteConfirmationError: data });
}
handleUntrackCustomFunction(e) {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class Metadata extends Component {
}
updateMetadataState(displayReloadMetadata) {
this.setState({
...this.state,
showMetadata: displayReloadMetadata,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class InsertItem extends Component {
// Since the state variable lifecycle is tired to the instance of the class
// and making this change using an anonymous function will case errors.
this.setState({
...this.state,
insertedRows: this.state.insertedRows + 1,
});
}
Expand Down
Loading