Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Release/strict swift #272

Open
wants to merge 164 commits into
base: master
Choose a base branch
from
Open

WIP Release/strict swift #272

wants to merge 164 commits into from

Conversation

dxinteractive
Copy link
Collaborator

@dxinteractive dxinteractive commented Jan 6, 2020

Contains #270, #273, #274, #276, #281, #282, #283, #284, #285, #287, #291, #292, #293, #295, #296, #298, #299, #300

Addresses #211, #264, #265, #266, #275, #277, #279, #280, #286, #289, #297

dataparcels

  • BREAKING CHANGE parcel.size() is now parcel.size
    • parcel.size returns 0 when called on parcels that aren't parents, instead of throwing an error like parcel.size() did
  • BREAKING CHANGE parcel.isChild() is now parcel.isChild
  • BREAKING CHANGE parcel.isElement() isremove
  • BREAKING CHANGE parcel.isIndexed() is removed
  • BREAKING CHANGE parcel.isParent() is now parcel.isParent
  • BREAKING CHANGE parcel.isTopLevel() has been removed
    • Did not hit any use cases in a year and a half. Use !parcel.isChild if you need it
  • BREAKING CHANGE parcel.isFirst() is now parcel.isFirstChild
  • BREAKING CHANGE parcel.isLast() is now parcel.isLastChild
  • BREAKING CHANGE parcel.spreadDOM() is now parcel.spreadInput()
  • BREAKING CHANGE parcel.spreadDOMCheckbox() is now parcel.spreadCheckbox()
  • BREAKING CHANGE parcel.onChange() has been removed
    • Use parcel.set() instead
  • BREAKING CHANGE parcel.onChangeDOM() has been removed
    • Using this function directly is rare, as the whole point of the DOM functions was to easily and automatically bind React form inputs to parcels. I've never hit the use case of wanting parcels to handle getting the value out of the change event from an input, but not also wanting the spreading of the value and onChange. But if you require this, you can use parcel.spreadInput().onChange
  • BREAKING CHANGE parcel. onChangeDOMCheckbox() has been removed
    • Using this function directly is rare, as the whole point of the DOM functions was to easily and automatically bind React form inputs to parcels. I've never hit the use case of wanting parcels to handle getting the value out of the change event from an input, but not also wanting the spreading of the value and onChange. But if you require this, you can use parcel.spreadInput(). onChangeDOMCheckbox
  • BREAKING CHANGE removed parcel.map()
    • use parcel.update(items => items.map(...)) instead
  • BREAKING CHANGE modifiers passed to parcel.update(), parcel.modifyUp and parcel.modifyDown now always pass entire parcel data (not just value) and expect either undefined or an object optionally containing value and meta. The meta is shallowly merged into existing meta.
  • BREAKING CHANGE parcel.modifyUp() now passes changeRequest key on first param, not as second param
    • parcel.modifyUp((value, changeRequest) => {}) becomes parcel.modifyUp(({value, changeRequest}) => {})
  • BREAKING CHANGE removed asRaw, as this is now the default behaviour of all updaters
  • BREAKING CHANGE removed asNode, because normal updaters cover all its uses now
  • BREAKING CHANGE removed parcel.spy() and parcel.spyChange()
    • use parcel.modifyDown(({value}) => { /* side effect */ }) and parcel.modifyUp(({changeRequest}) => { /* side effect */ }) instead, returning nothing
  • BREAKING CHANGE removed validation, will replace with a better one
  • BREAKING CHANGE stopped exporting Action, people shouldn't need to know this class exists
  • BREAKING CHANGE Stopped exporting flow types
  • BREAKING CHANGE Immutable.js is no longer supported
  • BREAKING CHANGE ParcelNode is no longer exported
  • BREAKING CHANGE asChildNodes is no longer exported
    • This will very likely return after version 2 as a feature, just don't want to have v2 stuck behind this
  • BREAKING CHANGE the way parcels are autokeyed has changed (#0, #1, #2 instead of #a, #b, #c)
  • Fix: parcel.update() now rebases correctly, passing new data through the updater, instead of retaining the result of the first execution as it did before V2 - make update() perform an "update" and not a "setData" #285
  • Added createUpdater() to allow people to create and compose their own updater functions
  • Added parcel.isOnlyChild
  • Allow Parcel.metaAsParcel() to be passed the meta from the original parcel, and to pass changes to meta back to the original parcel
  • Add dataparcels/translate to replace the functionality of ParcelBoundary's keepValue prop but in a way that supports multiple input instances, keep co-dependent code logic together, and uses far less code.
  • Add: modifyUp() can now return an effect that can be used to trigger one or more async changes in response to a change. They are called after the initial triggering change has taken place, similar to how React's useEffect is called after render. They can produce any number of changes by calling the update function, which works just like parcel.update(). This makes them compatible with callbacks, promises and observables.
  • Added promisify to replace asyncValue and asyncChange. The new effect / async change reducer make this really easy.
  • Added new Parcel({types: (defaultTypes) => newTypes}) to Parcel constructor
  • Added parcel.type, a string of "basic"|"object"|"unmutable"|"array" by default
  • Added parcel.parentType, a string of "basic"|"object"|"unmutable"|"array" by default
  • Added moveTo(newIndex) to children of "array" type parcels
  • Added static Parcel.metaEquals(metaA, metaB) for meta comparison

react-dataparcels

This is almost completely new.

  • BREAKING CHANGE removed all deprecated components (ParcelHoc, ParcelBoundaryHoc)
  • BREAKING CHANGE stopped exporting Action, people shouldn't need to know this class exists
  • BREAKING CHANGE removed useParcelForm (use useParcel instead)
  • BREAKING CHANGE removed useParcelState (use useParcel instead)
  • BREAKING CHANGE removed useParcelBuffer (use useBuffer instead)
  • BREAKING CHANGE removed ParcelBoundary (use Boundary instead)
  • BREAKING CHANGE removed asyncValue (useParcel and promisify can do this natively)
  • BREAKING CHANGE removed asyncChange (useParcel and promisify can do this natively)
  • BREAKING CHANGE rename ParcelDrag to Drag
  • Add useParcel to supersede useParcelState and useParcelForm
  • Add useBuffer to supersede useParcelBuffer
  • Add Boundary to supersede ParcelBoundary
  • Added undo and redo via -parcel.meta.undo() and parcel.meta.redo()
  • Adds parcel.meta.canUndo, parcel.meta.canRedo & parcel.meta.synced booleans
  • Add Drag as top level export: react-dataparcels/Drag
    • This does not increase default bundle size because all dataparcels files are independent exports
    • Performance: don't send event to update item order if no positions have changed after dragging

react-dataparcels-drag

  • Deprecate this package

To upgrade

  • Replace Parcel isChild() with isChild
  • Replace Parcel isElement() with parentType === 'array'
  • Replace Parcel isIndexed() with type === 'array'
  • Replace Parcel isParent() with isParent
  • Replace Parcel isTopLevel() with ! ... isChild
  • Replace Parcel size() with size
  • Replace Parcel isFirst() with isFirstChild
  • Replace Parcel isLast() with isLastChild
  • Find all useParcelBuffer and ParcelBoundary keepValue, remove, use translate instead
  • Replace spreadDOM() with spreadInput()
  • Replace spreadDOMCheckbox() with spreadCheckbox()
  • Replace .onChange with .set(
  • Replace .onChangeDOM with .spreadInput().onChange
  • Replace .onChangeDOMCheckbox with .spreadCheckbox().onChange
  • Replace react-dataparcels-drag with react-dataparcels/Drag
  • Review all usages of parcel.update(), parcel.modifyUp(), parcel.modifyDown(), beforeChange functions in hooks, and parcelNode.update(), to see if they need to change to fit brand new API
  • Replace spy(value => {...}) with modifyDown(({value}) => {...}) whose updater returns nothing
  • Replace spyChange(changeRequest) with modifyUp(({changeRequest}) => {...}) whose updater returns nothing
.modifyDown(value => value * 2)
// is now
.modifyDown({value}) => ({value: value * 2}))
// or using unmutable
.modifyDown(update('value', value => value *2))

@dxinteractive dxinteractive changed the title Release/strict swift WIP Release/strict swift Jan 6, 2020
Because trying to assign to a property that has a getter has no effect,
so the dev cant accidentally overwrite the getters, which was the main
reason that these errors existed
Previously the docs said parcelNode.update() would work with any updater type,
but it was only working with straight values. Fixed this by using prepUpdater.

Also moved out the logic to handle updating child nodes to the asChildNode file
which should help keep bundle sizes lower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant