This repository was archived by the owner on Feb 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 87
Roadmap to 3.0Β #127
Copy link
Copy link
Open
Labels
documentationThe documentation should be improved.The documentation should be improved.featureA new feature is requested.A new feature is requested.
Milestone
Description
This Issue serves as documentation for anticipated breaking changes in 3.0 and allows community feedback to drive the development process.
Breaking Changes π
- Do not re-export React from
reactn. Have users just import React and ReactN Component/hooks from separate packages. This will help with the namespace conflicts withComponentin TypeScript. - Remove support for
@reactndecorator. Typing the decorator is difficult to maintain, and the feature is not often (if ever?) used. - Property reducers/dispatchers to be moved to
addPropertyReducerandusePropertyDispatchinstead of sharing a namespace withaddReduceranduseDispatch.
New Features β¨
- Since the decorator is removed, the project can be pure TypeScript with the "as MagicType" happening in
src/index.ts. - Since
addPropertyReduceris given its own helper function, the property can be tightly coupled at the global level.addPropertyReducer(property, reducer)would be synonymous withaddReducer((global, dispatch, ...args) => ({ [property]: reducer(global[property], ...args) })). This may make some reducers easier to write. useSelector('id')as a simplified way to grabglobal.x.y.z.mutate(f).- Update the
/docsapp to reflect 3.0 as development occurs. - Rerendering of multiple subscriptions are batched. Batch re-renders on state change.Β #129
Undecided π
- Try to officialize
type Reducers = typeof reducersinreactn/global.d.ts. - Use a different helper function for adding reducers that dispatch other actions.
function reducer(global, ...args)andfunction reducer(global, dispatch, ...args)should both be acceptable ways to write a reducer.- Forcing users to write the latter is annoying when the majority of reducers do not use the dispatch parameter.
- This would require a verbiage change to describe reducers that dispatch and reducers that don't, e.g.
addReducerandaddSaga.
- Come up with solid verbiage for actions, reducers, dispatchers. The concept that actions and reducers are tightly coupled is not immediately obvious to users.
- Can the saga pattern be officialized? The global state manager has a concept of building up state changes before committing them. Should a commit/rollback method be exposed to saga reducers to allow them to build state before finalizing/committing it? Is the desired behavior of sagas to finish multiple state changes before re-rendering, or should the UI re-render as the state changes and the UI rolls back as the saga rolls back?
- Support deep-nested listeners? Perhaps only for objects that share an immediately prototype with Object or null, i.e. not instances of
Error, etc.useGlobal('x', 'y', 'z'). On state change, check all global subscriptions for shallow keys, then check all matches for shallow key changes. Implementation direction could use fleshing out.
totaldis, Brianop, vjsingh, markmssd, Seshpenguin and 7 more
Metadata
Metadata
Assignees
Labels
documentationThe documentation should be improved.The documentation should be improved.featureA new feature is requested.A new feature is requested.