nightism / react-scax Goto Github PK
View Code? Open in Web Editor NEWSynchronised wrapper for javascript promise.
License: ISC License
Synchronised wrapper for javascript promise.
License: ISC License
๐ Describe the bug
onFulfilment/onRejection seems to able to intake 'any' type of input in TScaxerBatchConfiguration
๐ Expected behavior
onFulfilment/onRejection should be configured to intake only callback or function type
๐คฉ Describe the solution you'd like
Add an additional scaxer state after scaxer.getData()
to indicate that the data has been retrieved at lease once after fulfilled.
๐ Describe the bug
PureComponent is not updating or rerendering when a scaxer finish execution.
โ๏ธ Additional context
This is because in the current logic of SCAX, this.setState({})
is used to rerender a component.
However, since PureCompoent uses shallowCompare
for state change, this.setState({})
will just not trigger a rerender.
๐ Is your feature request related to a problem? Please describe.
onFulfillment
and onRejection
can only be configured in TScaxerBatchConfiguration, which is not flexible enough.
This case hindered the development especially when more than scaxers to be called in different cases after fulfillment/rejection. Besides, since when configuring a scaxer to be a successor, a string will be passes in, thus there is no way to configure the input parameters.
๐คฉ Describe the solution you'd like
...
const myScaxer = pool.getScaxer('myscaxer')
...
myScaxer.call({}).onFulfillment(() => { ... })
// or alternatively
myScaxer.call(
{}, // parameters
() => { ... }, // onFulfillment
() => { ... }, // onRejection
๐ Describe the bug
A function component with hooks defined inside cannot be attached to any scaxers using attach
function.
๐ Expected behavior
FC is able to be attached to scax pool.
๐ Describe the bug
302 response is not being redirected.
**๐ฅบ Something to improve **
When TParamType
is not specified in TScaxerBatchConfiguration
, scaxer.call()
still must be passed with a parameter (of any types). This is because TParamType
will be interpreted as the unknown
type in this case.
**๐ Any suggestions? **
When TParamType
is not specified, scaxer.call()
can be called directly without any parameters.
๐ Describe the bug
Type of parameters must be specified when using AJAX_JSON_TEMPLATE.
Creating a scaxer without passing in a TParamType will lead to a type-incompatible-error.
๐ Expected behavior
A scaxer can be created without passing in a TParamType if there are no parameters needed.
๐คฉ Describe the solution you'd like
enable attach(poolObject, [scaxerObject1, scaxerObject2])(MyComponent)
๐ค Describe alternatives you've considered
The following scenario is a very common case, which is redundent:
...
import { pool, AUTH_INFO_SCAXER_NAME } from '../scaxer'
const authInfoScaxer = pool.getScaxer(AUTH_INFO_SCAXER_NAME)
...
class MyComponent extends React.Component { ... }
...
export default attach(pool.getName(), [AUTH_INFO_SCAXER_NAME])(MyComponent)
๐ฅบ Something to improve
...
let Component: any;
if (isAttachedComponentClass) {
Component = component;
} else if (isAttachedComponentWrapper) {
/**
* TODO: This if branch does that same as the previous one.
* May need to implements more provessing for wrapper components.
*/
Component = component;
} else { // If passed-in component is a user defined function component
Component = class extends React.Component<React.ComponentProps<C>> {
render() {
return (component as any)(this.props);
}
};
Component.displayName = displayName;
}
...
๐ Any suggestions?
As commented.
โ๏ธ Additional context
Calling saxer.call()
in componentDidMount
will trigger setState()
being called, which is an anti-pattern for react development.
Currently, our team seemed to solve it by using componentWillMount
in the wrapper component, which is also not a recommended workaround. Since this function is soon to be renamed as announced by React.
Further investigation is needed for this issue.
๐คฉ Describe the solution you'd like
Manually cancel a scaxer call.
i.e. myScaxer.cancel() // will terminate the current scaxer call if any
๐ค Describe alternatives you've considered
Current ScaxerBlocking
options can be an alternative to this feature.
๐ฅบ Something to improve
Ref type as any in WrapperComponent.
The HOC returned by attach
does not give any implication of the ref
type.
๐ Describe the bug
SCAXER.BlOCKING options are not exported, and it is unable to modify blocking options in typescript.
๐ Expected behavior
SCAXER.BlOCKING options are exported.
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.