We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E.g. if you have two computed values with the same dependencies (REPL), the generated code looks like this:
function recompute ( state, newState, oldState, isInitial ) { if ( isInitial || ( 'a' in newState && differs( state.a, oldState.a ) ) ) { state.x = newState.x = template.computed.x( state.a ); } if ( isInitial || ( 'a' in newState && differs( state.a, oldState.a ) ) ) { state.y = newState.y = template.computed.y( state.a ); } }
It could look like this:
function recompute ( state, newState, oldState, isInitial ) { if ( isInitial || ( 'a' in newState && differs( state.a, oldState.a ) ) ) { state.x = newState.x = template.computed.x( state.a ); state.y = newState.y = template.computed.y( state.a ); } }
Separately, I've been wondering about doing away with isInitial and just having a block like this at the start of the constructor:
isInitial
function App ( options ) { options = options || {}; this._state = options.data || {}; this._state.x = template.computed.x( state.a ); this._state.y = template.computed.y( state.a ); // ... } // instead of this: function App ( options ) { options = options || {}; this._state = options.data || {}; recompute( this._state, this._state, {}, true ); // ... }
Slightly more code, but maybe slightly less work? Not sure about this trade-off.
The text was updated successfully, but these errors were encountered:
collapse consecutive if-statements with the same condition (#450)
2852b96
Merge pull request #460 from sveltejs/gh-450
79c4563
fixed in 1.14
Sorry, something went wrong.
No branches or pull requests
E.g. if you have two computed values with the same dependencies (REPL), the generated code looks like this:
It could look like this:
Separately, I've been wondering about doing away with
isInitial
and just having a block like this at the start of the constructor:Slightly more code, but maybe slightly less work? Not sure about this trade-off.
The text was updated successfully, but these errors were encountered: