Coder Social home page Coder Social logo

Comments (9)

davidgilbertson avatar davidgilbertson commented on May 28, 2024

The collect function is a React higher order component, so couldn't be used to wrap a Stencil component. (I guess it would maybe work but you'd need both React and Stencil loaded).

Regarding the bug...
What version of react-recollect are you using? I accidentally published a version with no dist directory that was up for about 4 minutes last night :) So if you've got 2.1.1 please update to 2.1.2.

I haven't tested with Rollup, but if you peek into node_modules/react-recollect/dist/index.js can you tell me if you see the export? It takes the form

Object.defineProperty(exports, "store", {
  enumerable: true,
  get: function get() {
    return _store.store;
  }
});

which is just how Babel does exports.

from react-recollect.

danawoodman avatar danawoodman commented on May 28, 2024

I'm using 2.1.2 when this was created.

Here is dist/index.js:

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
Object.defineProperty(exports, "afterChange", {
  enumerable: true,
  get: function get() {
    return _updating.afterChange;
  }
});
Object.defineProperty(exports, "store", {
  enumerable: true,
  get: function get() {
    return _store.store;
  }
});
Object.defineProperty(exports, "collect", {
  enumerable: true,
  get: function get() {
    return _collect.collect;
  }
});

var _react = _interopRequireDefault(require("react"));

var _logging = require("./logging");

var _updating = require("./updating");

var _store = require("./store");

var _collect = require("./collect");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

if (!window.Proxy) {
  console.warn('This browser doesn\'t support the Proxy object, which react-recollect needs. See https://caniuse.com/#search=proxy to find out which browsers do support it');
}

window.__RR__ = {
  getStore: _store.getStore,
  getListeners: _updating.getListeners,
  debugOn: _logging.debugOn,
  debugOff: _logging.debugOff
};

Thanks!

from react-recollect.

davidgilbertson avatar davidgilbertson commented on May 28, 2024

I wonder if this is a Rollup bug? Surely not as I'm building that dist/index.js file with the default Babel settings so the Object.defineProperty(exports, "store", { pattern is used in heaps of libraries.

There's a similar error, also related to stencil.js: typestack/class-transformer#200.

I'll try a minimal build using Rollup.

from react-recollect.

danawoodman avatar danawoodman commented on May 28, 2024

Yeah it's weird. If you setup a brand new Stencil "app" project, install recollect and import it, you should be able to repro it. Thanks for investigating!

from react-recollect.

danawoodman avatar danawoodman commented on May 28, 2024

This relates to #44 right? Should we close this?

from react-recollect.

davidgilbertson avatar davidgilbertson commented on May 28, 2024

from react-recollect.

danawoodman avatar danawoodman commented on May 28, 2024

Ok cool, let me know when you want me to checkout things 👍

from react-recollect.

davidgilbertson avatar davidgilbertson commented on May 28, 2024

I'm going to close this one now. Rollup no longer has a problem.

But for the question in the issue name, react-recollect isn't going to work with anything but React any time soon. The reason: internally it 'knows' which components are reading which properties from the store by tying in very closely with the lifecycle methods, and updates the store at a very specific point in time so that shouldComponentUpdate and componentDidUpdate get the previous/next versions of the store and allows React to do its PureComponent magic.

Maybe one day I'll go the Redux route of being UI agnostic, but for now I'll leave as is.

Thanks for your input!

from react-recollect.

danawoodman avatar danawoodman commented on May 28, 2024

Makes sense, I figured it wasn't such a simple sort of thing to get working. Maybe I'll look into it someday... maybe...

from react-recollect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.