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.0.1 to 1.0.3

utils/generateUUID.js

12

CHANGELOG.md
# Change Log
## 1.0.3
### Bug Fixes
* [#308] Fix stack tracing for deep stacks
## 1.0.1

@@ -17,2 +23,8 @@

## 0.5.6
### Bug Fixes
* [#308] Fix stack tracing for deep stacks
## 0.5.5

@@ -19,0 +31,0 @@

68

lib/FluxibleContext.js

@@ -9,2 +9,4 @@ /**

var isPromise = require('is-promise');
var generateUUID = require('../utils/generateUUID');
var __DEV__ = process.env.NODE_ENV !== 'production';

@@ -145,20 +147,6 @@ require('setimmediate');

/*
* We store the action's stack array on the `stack` property
* of the actionContext interface.
* You can access this in your actions with `context.stack`.
* Use the `displayName` property on your actions for better
* action tracing when your code gets minified in prod.
* One action can execute multiple actions, so we need to create a shallow
* clone with a new stack & new id every time a newActionContext is created.
*/
var newActionContext = Object.assign({}, actionContext, {
stack: (actionContext.stack || []).concat([displayName]),
rootId: (actionContext.rootId) || generateUUID()
});
newActionContext.executeAction = newActionContext.executeAction.bind(newActionContext);
if (debug.enabled) {
debug('Executing action ' + newActionContext.stack.join('.') + ' with payload', payload);
debug('Executing action ' + actionContext.stack.join('.') + ' with payload', payload);
}
var executeActionPromise = callAction(newActionContext, action, payload);
var executeActionPromise = callAction(actionContext, action, payload);

@@ -179,3 +167,2 @@ if (done) {

/**

@@ -190,3 +177,4 @@ * Proxy function for executing an action.

FluxContext.prototype.executeAction = function executeAction(action, payload, done) {
return executeActionProxy(this, this.getActionContext(), action, payload, done);
var subActionContext = this._createSubActionContext(this.getActionContext(), action);
return executeActionProxy(this, subActionContext, action, payload, done);
};

@@ -204,2 +192,31 @@

/**
* Creates a subActionContext with new stack and rootID based on the action
* that will be executed.
* @private
* @method _createSubActionContext
* @param {Object} parentActionContext The action context that the stack should
* extend from
* @param {Function} action The action to be executed to get the name from
* @returns {Object}
*/
FluxContext.prototype._createSubActionContext = function createSubActionContext(parentActionContext, action) {
var displayName = action.displayName || action.name;
/*
* We store the action's stack array on the `stack` property
* of the actionContext interface.
* You can access this in your actions with `context.stack`.
* Use the `displayName` property on your actions for better
* action tracing when your code gets minified in prod.
* One action can execute multiple actions, so we need to create a shallow
* clone with a new stack & new id every time a newActionContext is created.
*/
var newActionContext = Object.assign({}, this.getActionContext(), {
stack: (parentActionContext.stack || []).concat([displayName]),
rootId: (parentActionContext.rootId) || generateUUID()
});
newActionContext.executeAction = newActionContext.executeAction.bind(newActionContext);
return newActionContext;
};
/**
* Returns the context for action controllers

@@ -219,5 +236,6 @@ * @method getActionContext

dispatch: self._dispatcher.dispatch.bind(self._dispatcher),
executeAction: function actionExecuteAction (action, payload, callback) {
executeAction: function executeAction (action, payload, callback) {
// `this` will be the current action context
return executeActionProxy(self, this, action, payload, callback);
var subActionContext = self._createSubActionContext(this, action);
return executeActionProxy(self, subActionContext, action, payload, callback);
},

@@ -240,12 +258,2 @@ getStore: self._dispatcher.getStore.bind(self._dispatcher)

/*
* Generate a GUID for keeping track of a
* transaction of actions and dispatches.
* Reference: https://github.com/facebook/react/blob/a48ffb04dcfe4d6f832207618a8b39e3034bd413/src/renderers/dom/server/ServerReactRootIndex.js
*/
var GLOBAL_UUID_MAX = Math.pow(2, 53);
function generateUUID () {
return Math.ceil(Math.random() * GLOBAL_UUID_MAX);
}
/**

@@ -252,0 +260,0 @@ * Returns the context for action controllers

{
"name": "fluxible",
"version": "1.0.1",
"version": "1.0.3",
"description": "A pluggable container for isomorphic flux applications",

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

@@ -16,2 +16,6 @@ /**

function callAction (action, context, payload, done) {
if (typeof action !== 'function') {
throw new Error('An action need to be a function');
}
if (done) {

@@ -18,0 +22,0 @@ return action(context, payload, done);

@@ -7,2 +7,3 @@ /**

var callAction = require('./callAction');
var generateUUID = require('./generateUUID');

@@ -13,2 +14,3 @@ function MockActionContext (dispatcherContext) {

this.dispatchCalls = [];
this.rootId = generateUUID();
}

@@ -15,0 +17,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