Closed agurtovoy closed 6 years ago
Correct -- https://unpkg.com/freactal@2.0.0/lib/helpers.js does not have the updated code.
@divmain -- Did maintainerd
somehow fail to publish latest transpiled code when https://github.com/FormidableLabs/freactal/pull/73 was merged way back when? Should I manually just publish a new version from master
from my CLI?
Looks like this one is not in the build either: https://unpkg.com/freactal@2.0.0/lib/effects.js
Here's a full diff of what we're missing using publish-diff
:
$ git checkout master
$ git pull
$ npm run build
$ publish-diff -o freactal -n .
Index: lib/effects.js
===================================================================
--- lib/effects.js freactal
+++ lib/effects.js .
@@ -20,10 +20,10 @@
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
- return Promise.resolve().then(function () {
- return effectFn.apply(undefined, [effects].concat(args));
+ return new Promise(function (resolve) {
+ return resolve(effectFn.apply(undefined, [effects].concat(args)));
}).then(applyReducer);
};
return memo;
Index: lib/helpers.js
===================================================================
--- lib/helpers.js freactal
+++ lib/helpers.js .
@@ -16,18 +16,26 @@
console.log("Both `hardUpdate` and `softUpdate` are deprecated. Please use `update` instead.");
};
var hardUpdate = exports.hardUpdate = function hardUpdate(newState) {
- displayDeprecationMessage();
+ var showWarning = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (showWarning) {
+ displayDeprecationMessage();
+ }
return function () {
return function (state) {
return Object.assign({}, state, newState);
};
};
};
var softUpdate = exports.softUpdate = function softUpdate(fn) {
- displayDeprecationMessage();
+ var showWarning = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+
+ if (showWarning) {
+ displayDeprecationMessage();
+ }
return function (effects) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
@@ -39,13 +47,13 @@
};
var update = exports.update = function update(fnOrNewState) {
if (typeof fnOrNewState === "function") {
- return softUpdate(fnOrNewState);
+ return softUpdate(fnOrNewState, false);
}
if ((typeof fnOrNewState === "undefined" ? "undefined" : _typeof(fnOrNewState)) === "object") {
- return hardUpdate(fnOrNewState);
+ return hardUpdate(fnOrNewState, false);
}
throw new Error("update must receive a reducer function or object to merge as its argument.");
};
Index: lib/server/context.js
===================================================================
--- lib/server/context.js freactal
+++ lib/server/context.js .
@@ -5,11 +5,8 @@
});
exports.getChildContext = getChildContext;
exports.getContext = getContext;
exports.getRootContext = getRootContext;
-
-var _lodash = require("lodash");
-
/**
* Code originally borrowed from the Rapscallion project:
* https://github.com/FormidableLabs/rapscallion/blob/44014d86a0855f7c3e438e6a9ee1e2ca07ff2cbe/src/render/context.js
*/
@@ -17,17 +14,17 @@
var EMPTY_CONTEXT = Object.freeze({});
function getChildContext(componentPrototype, instance, context) {
if (componentPrototype.childContextTypes) {
- return (0, _lodash.assign)(Object.create(null), context, instance.getChildContext());
+ return Object.assign(Object.create(null), context, instance.getChildContext());
}
return context;
}
function getContext(componentPrototype, context) {
if (componentPrototype.contextTypes) {
var contextTypes = componentPrototype.contextTypes;
- return (0, _lodash.keys)(context).reduce(function (memo, contextKey) {
+ return Object.keys(context).reduce(function (memo, contextKey) {
if (contextKey in contextTypes) {
memo[contextKey] = context[contextKey];
}
return memo;
Index: lib/server/set-state.js
===================================================================
--- lib/server/set-state.js freactal
+++ lib/server/set-state.js .
@@ -3,19 +3,18 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.syncSetState = syncSetState;
+/* eslint-disable no-invalid-this */
-var _lodash = require("lodash");
-
/**
* Code originally borrowed from the Rapscallion project:
* https://github.com/FormidableLabs/rapscallion/blob/44014d86a0855f7c3e438e6a9ee1e2ca07ff2cbe/src/render/state.js
*/
function syncSetState(newState, cb) {
// Mutation is faster and should be safe here.
- this.state = (0, _lodash.assign)(this.state, (0, _lodash.isFunction)(newState) ? newState(this.state, this.props) : newState);
+ this.state = Object.assign(this.state, typeof newState === "function" ? newState(this.state, this.props) : newState);
if (cb) {
cb.call(this);
\ No newline at end of file
}
-} /* eslint-disable no-invalid-this */
+}
@divmain -- I'm going to do an npm version patch
and npm publish
to fix this unless you've got any objections?
Any ETA for this?
@julien-f -- Don't know. While all of Formidable has access to this repo, we're waiting on @divmain to update the team's npm permissions so any of us can publish there.
I'm guessing Dale's still on vacation, and once he's back and updates some permissions we'll get things published π
@ryan-roemer ok :)
As a work-around: yarn add julien-f/freactal#pkg
I'm looking at this - should have a fix in the next day or so.
v2.0.1
should be up-to-date and published to npm
.
Generally speaking, how committed are you guys to freactal? We've been playing around with it and I have more PRs/questions I'm mulling over, but if you don't have the bandwidth, we'll just proceed with our own fork. TIA!
@agurtovoy I eventually developed my own βforkβ to address some of my needs without having to wait months π
Contributions are welcome π
We are actively working on Freactal and Dale's working on a roadmap going forward.
Our biggest snag to date is that we hit an awkward perfect storm of maintainerd
not keeping up to date with when publishing to npm
, Formidable not having npm
creds (bc we hadn't needed them with maintainerd
), and the holiday vacation period.
Thanks for the interest and love having y'all on board!
Thank you for the reassurance, @ryan-roemer.
@julien-f I like where you are going with the most of your changes, but middleware and hydrate support are critical for us.
I'll also add that I'd love to get people involved in managing freactal directly. In my other projects, that has helped to keep momentum up and fill in gaps when I have no availability.
@julien-f @agurtovoy would you be interested in participating in a more formal capacity? If so, let's find a time to sync up over video conference, pull in the Formidable folks, and figure out if there's a way for us to collaborate.
I do apologize for the delays in addressing issues. Six months into a new position, and there's been less time for OSS work than I expected. But things are looking better moving forward :)
@divmain I'm interested; my email is in my profile.
@divmain Thank you, I don't have much time for this at the moment. I will keep developing my fork in parallel and opening issues here for the time being π
For example, this fix is not present in the npm package's sources: