HenrikJoreteg / redux-bundler

Compose a Redux store out of smaller bundles of functionality.
https://reduxbundler.com
583 stars 46 forks source link

Ghostly redux-bundler 28 release? #79

Closed odinho closed 3 years ago

odinho commented 3 years ago

There's a redux bundler 28 on npm, but it's not really anywhere to be found in code, with no changelog or commits. What is it?

It seems to have a tiny refactoring of the reactor bundle.

diff --git a/rb27-2/package/dist/redux-bundler.js b/rb28/package/dist/redux-bundler.js
index 7b72ab4..760c5ce 100644
--- a/rb27-2/package/dist/redux-bundler.js
+++ b/rb28/package/dist/redux-bundler.js
@@ -1617,6 +1617,27 @@ var reactors = (function (spec) { return ({
       }); });
     }

+    store.getNextReaction = function (skipPermissionCheck) {
+      if ( skipPermissionCheck === void 0 ) skipPermissionCheck = false;
+
+      for (var i = 0, l = store.meta.reactorNames.length; i < l; i++) {
+        var name = store.meta.reactorNames[i];
+        var result = store[name]();
+
+        if (result) {
+          // enable passing a fn to check whether a given reactor should be allowed
+          if (!skipPermissionCheck && reactorPermissionCheck && !reactorPermissionCheck(name, result)) {
+            continue;
+          }
+
+          return {
+            name: name,
+            result: result
+          };
+        }
+      }
+    };
+
     if (process.env.NODE_ENV !== 'production') {
       store.meta.reactorNames.forEach(function (name) {
         if (!store[name]) {
@@ -1632,36 +1653,30 @@ var reactors = (function (spec) { return ({
       }
     };

+    var dispatchNextReaction = function () {
+      // make sure it's still relevant and store it
+      // this time don't verify permission, we already
+      // did once.
+      store.nextReaction = store.getNextReaction(true);
+
+      if (store.nextReaction) {
+        var nextReaction = store.nextReaction;
+        store.nextReaction = null;
+        store.dispatch(nextReaction.result);
+      }
+    };
+
     var dispatchNext = function () {
       // one at a time
       if (store.nextReaction) {
         return;
-      } // look for the next one
-
+      } // store next reaction for reference

-      store.meta.reactorNames.some(function (name) {
-        var result = store[name]();

-        if (result) {
-          // enable passing a fn to check whether a given reactor should be allowed
-          if (reactorPermissionCheck && !reactorPermissionCheck(name, result)) {
-            return;
-          }
-
-          store.activeReactor = name;
-          store.nextReaction = result;
-          return result;
-        }
-      });
+      store.nextReaction = store.getNextReaction();

       if (store.nextReaction) {
-        // let browser chill
-        ric(function () {
-          var nextReaction = store.nextReaction;
-          store.activeReactor = null;
-          store.nextReaction = null;
-          store.dispatch(nextReaction);
-        }, ricOptions);
+        ric(dispatchNextReaction, ricOptions);
       }
     };

@@ -2001,7 +2016,7 @@ var url = (function (opts) {
   };
 });

-var version = "27.0.2";
+var version = "28.0.0";

 var createDebug = (function (spec) {
   var ENABLE = 'DEBUG_ENABLED';
@@ -2126,12 +2141,13 @@ var createDebug = (function (spec) {
       var store = ref.store;

       var nextReaction = store.nextReaction;
-      var activeReactor = store.activeReactor;

       if (nextReaction) {
-        log(nextReaction, {
+        var name$$1 = nextReaction.name;
+        var result = nextReaction.result;
+        log(result, {
           color: colorOrange,
-          label: ("next reaction " + activeReactor + ":")
+          label: ("next reaction " + name$$1 + ":")
         });
       }
     }; },
HenrikJoreteg commented 3 years ago

@odinho oh wow. So... I had changed my "publish to npm" script that I use to push to "main" instead of "master" because that's what I'm doing for new repos these days. But as a result my local changelog changes were never pushed to github. But... it did publish to npm. Sorry!

I just pushed those changes to master. Here's the changelog with the update: https://github.com/HenrikJoreteg/redux-bundler/blob/master/docs/misc/changelog.md#change-log