Code Monkey home page Code Monkey logo

lenrix's People

Contributors

couzic 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

Watchers

 avatar  avatar  avatar  avatar

Forkers

c-jacquin

lenrix's Issues

Enable custom change detection strategy

store.changeDetectionStategies({
    myValue: (previousValue, nextValue) => previousValue.myField === nextValue.myField
})

Since this case is so common:

store.changeDetectionSelectors({
    birthDate: _  => _.getTime()
})

Store.updateFieldValues()

Add the ability to do something like:

store.updateFieldValues(state => ({
   prop1: state.prop2,
   prop2: state.prop1
}))

Requires lenrix #4 to be solved first

Store.updates.shouldNotCompile

// Registering update with unknown action @shouldNotButDoesCompile
store.updates(_ => ({
   doString: s => _.focusPath('counter').setValue(42),
   unknown: s => _.focusPath('counter').setValue(42),
}))

Actions

Define and implement the API to allow the dispatch and handling of actions on a Store. Open questions:

  • SIngle VS multiple action handlers
  • Handle actions on rootStore only ?
  • Local actions ?

webpack hot module reload support

In order to make webpack hot module reload work properly we need to have something like this to update the store when an update, a computed value or an epic is modified.

redux and redux-observable already implement this feature.

Do you think it is possible ? easy ?

if (module.hot) {
  module.hot.accept('../reducers', () =>
    store.replaceReducer(require('../reducers')) // eslint-disable-line global-require
  );

  const epic$ = new BehaviorSubject(rootEpic);
  module.hot.accept('./where-ever-they-are', () => {
    const nextRootEpic = require('./where-ever-they-are').rootEpic;
    epic$.next(nextRootEpic);
  });
}

https://redux-observable.js.org/docs/recipes/HotModuleReplacement.html

Store.reset()

Useful to set state or slice of state back to initial state

computeFrom() does not recompute when focused field is undefined

  .computeFrom(
    _ => ({
      selectedCategoryProduct: _.focusPath(
        'productSelect',
        'selectedCategoryProduct',
      ),
    }),
    ({ selectedCategoryProduct }) => ({
      statsProductOptions:
        selectedCategoryProduct === undefined
          ? undefined
          : selectedCategoryProduct.products.map(toOption),
    }),
  )

Problem: statsProductOptions never get undefined

extract()

Example:

const extract$: Observable<{a: A, c: C}> = store.extract({
   a: store.lens.focusOn('a'),
   c: store.lens.focusOn('b').focusOn('c')
})

extract$ only emits for new values of a or c

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.