temporarily remote autorefresh and loop protect

This commit is contained in:
Cassie Tarakajian 2016-10-04 15:35:23 -04:00
parent 1232e4c5ca
commit dfc55aaa5b
5 changed files with 28 additions and 15 deletions

View file

@ -68,11 +68,14 @@ class Editor extends React.Component {
this._cm.on('change', debounce(1000, () => {
this.props.setUnsavedChanges(true);
this.props.updateFileContent(this.props.file.name, this._cm.getValue());
this.checkForInfiniteLoop((infiniteLoop, prevs) => {
if (!infiniteLoop && prevs && this.props.autorefresh) {
if (this.props.autorefresh && this.props.isPlaying) {
this.props.startRefreshSketch();
}
});
// this.checkForInfiniteLoop((infiniteLoop, prevs) => {
// if (!infiniteLoop && prevs && this.props.autorefresh) {
// this.props.startRefreshSketch();
// }
// });
}));
this._cm.on('keyup', () => {

View file

@ -72,7 +72,7 @@ class Toolbar extends React.Component {
>
<InlineSVG src={stopUrl} alt="Stop Sketch" />
</button>
<div className="toolbar__autorefresh">
{/* <div className="toolbar__autorefresh">
<input
id="autorefresh"
type="checkbox"
@ -84,7 +84,7 @@ class Toolbar extends React.Component {
<label htmlFor="autorefresh" className="toolbar__autorefresh-label">
Auto-refresh
</label>
</div>
</div> */}
<div className={nameContainerClass}>
<a
className="toolbar__project-name"

View file

@ -8,7 +8,7 @@ const initialState = {
lintWarning: false,
textOutput: false,
theme: 'light',
autorefresh: true
autorefresh: false
};
const preferences = (state = initialState, action) => {

View file

@ -17,7 +17,7 @@ const userSchema = new Schema({
lintWarning: { type: Boolean, default: false },
textOutput: { type: Boolean, default: false },
theme: { type: String, default: 'light' },
autorefresh: { type: Boolean, default: true }
autorefresh: { type: Boolean, default: false }
}
}, { timestamps: true });

View file

@ -117,11 +117,21 @@ import User from '../models/user';
// });
// });
User.findOne({email: 'test@test.com'})
.exec((err, user) => {
console.log(user);
user.password = '1234';
// User.findOne({email: 'test@test.com'})
// .exec((err, user) => {
// console.log(user);
// user.password = '1234';
// user.save((err, savedUser) => {
// console.log('user saved');
// });
// });
User.find({})
.exec((err, users) => {
users.forEach(user => {
user.preferences.autorefresh = false;
user.save((err, savedUser) => {
console.log('user saved');
});
});
});