buildo / revenge Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED use React.PureComponent and react-skinnable instead
License: MIT License
DEPRECATED use React.PureComponent and react-skinnable instead
License: MIT License
e.g.
@log
without ()
@anonymous
readyState
, loading
and cache
are always false because it's checked a property of a String
loading
should be true when at least one query
is loadingsince it's not lazy and thus basically useless / potentially dangerous
Reading the code of autobound I noticed that the method seems attached to the instance, not to the prototype ... so instead of
import { autobound } from 'web-framework';
class Wrapper extends React.Component {
@autobound
method() {
console.log(this.props.name);
}
render() {
return <Wrapped method={this.method} />;
}
}
yesterday @gabro suggested something like this
class Wrapper extends React.Component {
method = () => console.log(this.props.name);
render() {
return <Wrapped method={this.method} />;
}
}
@log
function sum(a, b) {
return a + b
}
sum(1, 2); // prints to console: "sum(1, 2) => 3"
"pure" name is misleading: it could be applied to a component which is not pure. the decorator simply states that the component will be optimized with a default shouldComponentUpdate
method relying on references
used by props decorator
3-6-15
avenger things
revenge:
Before
new Query(
'queryUser',
() => return this.db.getUser(userId),
() => return this.API.fetchUser(userId),
['queryConfig']
);
After
new Query({
id: 'queryUser',
get: () => return this.db.getUser(userId),
fetch: () => return this.API.fetchUser(userId),
dependencies: ['queryConfig']
});
Just noticed that the iso redirect when no cookie is set doesn't work anymore.
It is likely caused by the issue @gcanti pointed out: static methods not handled correctly by react-router with the current implementation of @authenticated()
Just opening this to get back here if that is not the case
requirements:
use @pure
(and potentially any other pure-render tool) correctly when props
involve .bind
ed and/or partial
lly applied functions
i.e: avoid unnecessary re-renderings
see e.g. this for reference: https://discuss.reactjs.org/t/using-function-bind-and-purerendermixin/655
spec proposal:
@pureFunctions
decorator, to be used on top of @pure
should let you pass to @pureFunctions
-decorated components functions as:
onClick={[myFn, myArg1, myArg2]}
instead of
onClick={myFn.bind(this, myArg1, myArg2)}
and handle properly the reference for the underlying @pure
component: reuse cached fn references when fn and args are unchanged
This gives big perf improvements e.g. on LOL/SamplesList for cellRenderer
and SampleCard.onClick
props
@FrancescoCioria @francescogior thoughts about the syntax?
In order to maximize the benefits of PureComponent
Can we have an official branch with v0.1.3 ?
something like
.*
*.log
node_modules
src
test
I think it's a standard to provide a ready to go package on npm:
src # ES6
lib # transpiled files (ES5)
index.js # npm package entry point
currently can cause duplicate query declarations to be filtered out even if only one filter
condition is false
we must enforce somehow the npm run build
script execution
the @pure decorator should be enough. Moreover it will be possible to freely extend a custom class
Requirements
Specs TBD
fetch
state in revenge and to provide components using @queries
with an additional fetchState
or similar prop (basically 'loading'/'done'[/'error'?]).fetchState
can be kept by revenge itself looking at queries incrementally providing fresh databe sure to have a read at this first: http://facebook.github.io/relay/docs/guides-ready-state.html#content
queryData
-> null
-> queryData
cacheMode
if you want to skip the null
), but I see less and less practical uses for cacheMode=no
queries@utaal @gcanti @francescogior additional thoughts?
nextPath=%2F
breaks https://github.com/buildo/labonline DefaultRoute
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.