Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fluxible

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluxible - npm Package Compare versions

Comparing version 1.3.0-alpha.1 to 1.3.0

6

CHANGELOG.md
# Change Log
## 1.3.0
### Enhancement
* [#494] Remove setImmediate from rehydration promise
## 1.2.0

@@ -4,0 +10,0 @@

10

lib/Fluxible.js

@@ -214,7 +214,9 @@ /**

.then(function (contextValue) {
// Ensures that errors in callback are not swallowed by promise
setImmediate(callback, null, contextValue);
callback(null, contextValue);
}, function (err) {
// Ensures that errors in callback are not swallowed by promise
setImmediate(callback, err);
callback(err);
})['catch'](function (err) {
setImmediate(function () {
throw err;
});
});

@@ -221,0 +223,0 @@ }

2

package.json
{
"name": "fluxible",
"version": "1.3.0-alpha.1",
"version": "1.3.0",
"description": "A pluggable container for isomorphic flux applications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,19 +17,20 @@ /**

function callAction (actionContext, action, payload, done) {
// Use a promise to force the action to be called async
var executeActionPromise = Promise.resolve().then(function () {
// Assume the action returns a promise since it doesn't take a callback
if (action.length < 3) {
return action(actionContext, payload);
}
// Return a nested promise to wrap the action invocation so its result
// passed to its callback can be captured
return new Promise(function (resolve, reject) {
action(actionContext, payload, function (err, result) {
if (err) {
reject(err);
} else {
resolve(result);
var executeActionPromise = new Promise(function (resolve, reject) {
setImmediate(function () {
try {
var syncResult = action(actionContext, payload, function (err, result) {
if (err) {
reject(err);
} else {
resolve(result);
}
});
if (isPromise(syncResult)) {
syncResult.then(resolve, reject);
} else if (action.length < 3) {
resolve(syncResult);
}
});
} catch (e) {
reject(e);
}
});

@@ -39,18 +40,12 @@ });

if (done) {
// Once our promise (and any nested promises) fully settle, call the
// `done()` callback provided to us and pass either the result or error
executeActionPromise
.then(function (result) {
done(null, result);
}, done)
['catch'](function (err) {
// Ensures that thrown errors in the `done()` callback above are
// not swallowed by promise
setImmediate(function () {
throw err;
});
.then(function(result) {
// Ensures that errors in callback are not swallowed by promise
setImmediate(done, null, result);
}, function (err) {
// Ensures that errors in callback are not swallowed by promise
setImmediate(done, err);
});
}
// Finally return our original promise with the result of calling the action
return executeActionPromise;

@@ -57,0 +52,0 @@ }

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