Git Product home page Git Product logo

hocs's Introduction

👋

hocs's People

Contributors

deepsweet avatar nmccready avatar zoltantothcom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hocs's Issues

[QUESTION] - Why don't use just `isOnline`?

In the with-online-status-props component, why don't use just isOnline property in state? If is offline soon will not true, in the isOnline property

this.state = mapStatusToProps({
        isOnline: global.navigator.onLine,
        isOffline: !global.navigator.onLine
      })

Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'

versions:
react - 16.2.0
with-intersection-observer-props - 0.4.0

code:

import React from 'react'
import { injectProps } from 'relpers'
import { compose, setDisplayName, onlyUpdateForKeys, lifecycle, defaultProps } from 'recompose'
import withIntersectionObserverProps from '@hocs/with-intersection-observer-props'
import { hideIf } from 'utils'
import './styles.css'

const enhance = compose(
  hideIf(({ hide }) => hide),
  setDisplayName('LoadMore'),
  defaultProps({
    isOnePixelVisible: false,
  }),
  onlyUpdateForKeys(['hide', 'loading', 'isOnePixelVisible', 'loadMore']),
  withIntersectionObserverProps({
    isOnePixelVisible: 0.0,
  }),
  lifecycle({
    @injectProps
    componentDidUpdate({ isOnePixelVisible, loadMore }) {
      if (isOnePixelVisible) {
        loadMore()
      }
    },
  }),
)

const LoadMore = enhance(({ loading }) =>
  <load-more>{loading && 'loading…'}</load-more>,
)

export default LoadMore

error:

index.js?bac1:47 Uncaught TypeError: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
    at WithIntersectionObserverProps.componentDidMount (index.js?bac1:47)
    at commitLifeCycles (react-dom.development.js?054f:8770)
    at commitAllLifeCycles (react-dom.development.js?054f:9946)
    at HTMLUnknownElement.callCallback (react-dom.development.js?054f:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?054f:581)
    at invokeGuardedCallback (react-dom.development.js?054f:438)
    at commitRoot (react-dom.development.js?054f:10050)
    at performWorkOnRoot (react-dom.development.js?054f:11017)
    at performWork (react-dom.development.js?054f:10967)
    at requestWork (react-dom.development.js?054f:10878)

image

'recompose' does not contain an export named 'createEagerFactory'

This error occurs in the console when running npm run build after updating recompose from v0.25.1 to v0.26.0

PS C:\Users\alex\apf2> npm run build

> [email protected] build C:\Users\alex\apf2
> react-scripts build

Creating an optimized production build...
Failed to compile.

./node_modules/@hocs/with-lifecycle/es/index.js
14:18-36 'recompose' does not contain an export named 'createEagerFactory'.

debounce-handler: deal with component unmount

Hi there!

It's more of a question here. Let's say we have a callback with really big delay, in that case the callback might be invoked after the wrapped component had already been unmounted. Should debounce-handler do something with that? e.g. it might prevent debounced function from firing after component unmount, or force to run it right before component unmount, to ensure the last call done while component is still alive.

getDerivedStateFromProps

Hi! Cool HOC collection!

Could you please provide a usage example of a getDerivedStateFromProps method?
Is it just work inside onReceiveProps but with new logic?

Errors with meteor

Hi
I used withLog version 0.2, all is fine.
But version 0.3, even after updating recompose from 0.25.1 to 0.26, gives with Meter a lot of errors with
Uncaught TypeError: Cannot read property 'meteorInstall' of undefined
I really have no clue what it is even after googling

Maintainer is needed

Hi.

I personally don't have much time to maintain the project anymore and would really appreciate if someone could take care of it.

Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'

versions:
react - 16.2.0
with-intersection-observer-props - 0.4.0

code:

import React from 'react'
import { injectProps } from 'relpers'
import { compose, setDisplayName, onlyUpdateForKeys, lifecycle, defaultProps } from 'recompose'
import withIntersectionObserverProps from '@hocs/with-intersection-observer-props'
import { hideIf } from 'utils'
import './styles.css'

const enhance = compose(
  hideIf(({ hide }) => hide),
  setDisplayName('LoadMore'),
  defaultProps({
    isOnePixelVisible: false,
  }),
  onlyUpdateForKeys(['hide', 'loading', 'isOnePixelVisible', 'loadMore']),
  withIntersectionObserverProps({
    isOnePixelVisible: 0.0,
  }),
  lifecycle({
    @injectProps
    componentDidUpdate({ isOnePixelVisible, loadMore }) {
      if (isOnePixelVisible) {
        loadMore()
      }
    },
  }),
)

const LoadMore = enhance(({ loading }) =>
  <load-more>{loading && 'loading…'}</load-more>,
)

export default LoadMore

error:

index.js?bac1:47 Uncaught TypeError: Failed to execute 'observe' on 'IntersectionObserver': parameter 1 is not of type 'Element'.
    at WithIntersectionObserverProps.componentDidMount (index.js?bac1:47)
    at commitLifeCycles (react-dom.development.js?054f:8770)
    at commitAllLifeCycles (react-dom.development.js?054f:9946)
    at HTMLUnknownElement.callCallback (react-dom.development.js?054f:542)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?054f:581)
    at invokeGuardedCallback (react-dom.development.js?054f:438)
    at commitRoot (react-dom.development.js?054f:10050)
    at performWorkOnRoot (react-dom.development.js?054f:11017)
    at performWork (react-dom.development.js?054f:10967)
    at requestWork (react-dom.development.js?054f:10878)

image

@deepsweet (you've said):
There should be ref={onRef} assigned to the target's DOM primitive like div or something. I'll mention this more explicitly in readme.

I mean subject HOC provides onRef prop as well as isOnePixelVisible which you want. In basic scenario it could look like this:

const LoadMore = enhance(({ loading, onRef }) =>
  <div ref={onRef}>{loading && 'loading…'}</div>,
)

I don't know what is in your case but it looks like onRef should be propagated down to the actual DOM primitive.

and I responded:
load-more is the actual DOM primitive, we use semantic html (as in web components) instead of plain div containers (which makes the dom structure a lot clearer).
after adding the ref as you've written it still isn't working and outputting the same error message.

[v0.3.0] Cannot import `@hocs/debounce-handler` using browserify

It looks like recent package.json change(adding browser field) breaks module import via browserify.

e56d273#diff-fa58850984d1284fe1035e891a0d5b50

# not works...
import debounceHandler from '@hocs/debounce-handler'

When i specify import path like this(using main setting in package.json), import works correctly.

# works!
import debounceHandler from '@hocs/debounce-handler/build/node-cjs'

Error

SyntaxError: 'import' and 'export' may only appear at the top level (14:0) while parsing /Users/subuta/repo/xxxxx/node_modules/@hocs/debounce-handler/build/browser-esm/index.js while parsing file: /Users/subuta/repo/xxxxx/node_modules/@hocs/debounce-handler/build/browser-esm/index.js

Package version

.babelrc

{
  "presets": [
    "es2015",
    "stage-2",
    "react"
  ]
}

cjs build is not transpiled correctly

When using the cjs build I get an error:

Module parse failed: .../@hocs/omit-props/build/node-cjs/index.js Line 17: Unexpected token .
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
| const omitProps = (...propsToOmit) => Target => {
|   const OmitProps = props => (0, _react.createElement)(Target, (0, _justOmit2.default)(props, propsToOmit));

It is most likely related to the spread operator:

const omitProps = (...propsToOmit) => Target => {

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.