Socket
Socket
Sign inDemoInstall

react-isomorphic-boilerplate

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-isomorphic-boilerplate - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

src/reducers/entities/post.spec.js

3

package.json
{
"name": "react-isomorphic-boilerplate",
"version": "0.1.1",
"version": "0.1.2",
"main": "src/server/index.js",

@@ -72,2 +72,3 @@ "license": "MIT",

"dependencies": {
"classnames": "^2.2.5",
"express": "^4.16.2",

@@ -74,0 +75,0 @@ "moment": "^2.19.2",

@@ -6,2 +6,3 @@ import React from 'react';

import { get as _get } from 'lodash';
import classNames from 'classnames';
import { addPost } from '../../../actions';

@@ -20,3 +21,4 @@

this.state = {
postText: ''
postText: '',
isShowInvalid: false
};

@@ -28,4 +30,17 @@

validateShowError(text) {
return text.length < 256;
}
validate(text) {
return text.length > 0 && text.length < 256;
}
onPostTextChanged(e) {
this.setState({postText: e.target.value});
const postText = e.target.value;
const isShowInvalid = !this.validateShowError(postText);
this.setState({
postText,
isShowInvalid
});
}

@@ -41,3 +56,3 @@

};
if (postText.length) {
if (this.validate(postText)) {
addPost(payload)

@@ -53,2 +68,4 @@ .then(() => {

render() {
const { isShowInvalid } = this.state;
return (

@@ -58,3 +75,9 @@ <form className="form--post" onSubmit={this.onPostSubmit}>

<div className="form-row">
<textarea className="input--post-text" value={this.state.postText} onChange={this.onPostTextChanged} />
<textarea
className={classNames('input--post-text', {
'is-error': isShowInvalid
})}
value={this.state.postText}
onChange={this.onPostTextChanged}
/>
<div className="btn-wrapper">

@@ -61,0 +84,0 @@ <button className="btn--post-submit" type="submit">Submit</button>

@@ -43,3 +43,7 @@ import React from 'react';

<li className="postlist">
<p className="text">{p.text}</p>
<p className="text">
{p.text.split('\n').map((p, i) => {
return <p key={i}>{p}</p>;
})}
</p>
<div>

@@ -46,0 +50,0 @@ <span className="arthur">{p.arthur} </span>

import update from 'immutability-helper';
import { get as _get } from 'lodash';
import { get as _get, isEqual as _isEqual } from 'lodash';
import stdout from '../../stdout';

@@ -22,3 +22,6 @@ const debug = stdout('reducer:post');

case 'FETCH_POSTS': {
if (payload.entities.posts) {
const postEntities = _get(payload, 'entities.posts', {});
// don't update if there are the same
if (!_isEqual(postEntities, state)) {
return update(state, {

@@ -25,0 +28,0 @@ $merge: payload.entities.posts

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc