Skip to content

Releases: 92green/dataparcels

Version 1.0.0 🎉

25 Sep 01:40
Compare
Choose a tag to compare

Contains #233 #245 #248 #249 #251 #256

Addresses #235 #236 #239 #241, #246, part of #242, #254 #255

dataparcels

Size of default import was 13.1KB, now 10.3KB (21% decrease)

  • BREAKING CHANGES
    • Removed parentParcel.toObject()
    • Removed parentParcel.set(key, value) (parcel.set(value) still exists)
    • Removed parentParcel.update(key, updater) (parcel.update(updater) still exists)
    • Removed parentParcel.delete(key) (childParcel.delete() still exists)
    • Removed parentParcel.setIn() completely
    • Removed parentParcel.updateIn() completely
    • Removed parentParcel.deleteIn() completely
    • Removed parentParcel.insertAfter(key, value) (childParcel.insertAfter(value) still exists)
    • Removed parentParcel.insertBefore(key, value) (childParcel.insertBefore(value) still exists)
    • Removed move() completely
    • Removed elementParcel.swap(otherKey) (parentParcel.swap(keyA, keyB) still exists)
    • Removed parentParcel.swapNext(otherKey) (elementParcel.swapNext() still exists)
    • Removed parentParcel.swapPrev(otherKey) (elementParcel.swapPrev() still exists)
    • Removed shape.toObject()
    • Removed shape.move() completely
    • Removed swap() completely
    • Removed swapNext() completely
    • Removed swapPrev() completely
    • Removed changeRequest.toJS()
    • Removed action.toJS()
  • BREAKING CHANGE remove ParcelShape and asShape
    • Use asNode and asChildNodes instead
  • Added dataparcels/asNode for changing meta easily in an updater
  • Added dataparcels/asChildNodes
  • Added dataparcels/ParcelNode
  • Added ChangeRequest.hasDataChanged(keyPath)
  • Temporarily disabled runtime type checking
  • Stopped showing warning about not changing shape in a value updater

react-dataparcels

  • fix: issue where debounced buffer hooks didnt rebase properly
  • fix: upgrade unmutable to fix useParcelBuffer infinite rerender NaN bug
  • Add asyncValue for loading an initial value into useParcelState and useParcelForm using promises
  • Add asyncChange for saving data asynchronously from calls to useParcelState.onChange
  • Add onChangeUseResult option to useParcelState
  • Add react-dataparcels/asNode
  • Add react-dataparcels/asChildNodes
  • Add react-dataparcels/ParcelNode
  • Added ability for useParcelState and useParcelForm to accept parcel updaters as their values. This allows previous values to be accessed, and allows meta to be set from props or set based upon previous data.
  • add: rebase option on useParcelState and useParcelForm
    • this will allow changes from props to slide in underneath changes in useParcelBuffer hooks and ParcelBoundaries, so data can change without losing unsaved changes.
  • add: post-sideeffecthook changes now rebase underneath buffered changes
    • almost more of a fix than a feature... this allows changes made after a submit() to not get replaced once a promise returned by onSubmit resolves. Only affects cases where onSubmitUseResult is not used. If onSubmitUseResult then replacing the value is the right behaviour.

Fix for useParcelForm beforeChange

22 Jul 12:20
Compare
Choose a tag to compare

Non-arrays can now be passed

Fixes for ParcelBoundary debounce and ParcelDrag input focus

16 Jul 10:46
Compare
Choose a tag to compare

react-dataparcels

  • fix: useParcelBuffer should debounce even when buffer param is explicitly set to false.
  • No breaking changes

react-dataparcels-drag

  • fix: react-dataparcels-drag should never have hocked in a render method. Fixes bug where hoc remounts ever render, which throws focus off of inputs as you type.
  • No breaking changes

useParcelForm.onSubmit()

16 Jul 02:49
Compare
Choose a tag to compare

Contains #229 #230

Addresses the first half of #123

dataparcels

  • Fix issue where change requests's cache wasn't being reset by dispatch() when it should
  • Refactor to remove _lastOriginId, replace with more generic frameMeta
    • frameMetas job is to hold data that should only exist until the next change occurs (the current parcel frame). lastOriginId requires that same data lifespan.
    • lastOriginId was a concept that only react-dataparcels was interested in, and probably shouldnt have been put in plain dataparcels
  • No breaking changes

react-dataparcels

  • BREAKING CHANGE useParcelForm's API has had some renaming
    • useParcelForm onChange is now useParcelForm onSubmit
    • useParcelForm onChangeUseResult is now useParcelForm onSubmitUseResult
    • useParcelForm's returned onChangeStatus is now submitStatus
    • The reason is because the action is being referred to as submit everywhere else. Even the function that triggers the submit is called "submit". This was called onChange, because from the point of view of the internal useParcelState hook it is just a "change", and that variable name just flew out the window but the name should really reflect how its used
  • refactor to use frameMeta to set and get lastOriginId
  • refactor that added ability for useParcelBuffer (and therefore useParcelForm) to rebase changes when frameMeta.mergeMode === "rebase"
    • This will be used by rekey to rebase changerequests onto values that have updated
    • Not part of public API yet

useParcelForm Request state

19 Jun 04:31
Compare
Choose a tag to compare

Addresses a missing piece of #181

react-dataparcels

  • BREAKING CHANGE ParcelBufferControl class removed. useParcelBuffer, ParcelBoundary and useParcelForm all now return an identically shaped object in its place. This requires no code changes if you are not using the ParcelBufferControl named export.
  • Added request state info to useParcelForm #181
    • useParcelForm.onChange can already deal with promises and can handle what happens when they resolve and reject. Not passing the current state of the promise out of the hook would lead to people having to wrap their promises in something that can keep state based off of each promise,
      so much better to include that functionality natively and have it test covered and standardised.
    • You probably wouldnt bother using it if you have some other thing like enty or async data stored in redux

useParcelForm with promises, revertable changes, drag with render props

06 Jun 05:57
Compare
Choose a tag to compare

Addresses #181 #182 #214

react-dataparcels

  • BREAKING CHANGE useParcelBuffer now submits when buffer is empty
    • before, calling submit on an empty buffer did nothing, but this makes it very difficult to resubmit, and considering how easy it is to cancel a change based on whats in it (i.e. changeRequest.hasValueChanged()) then changing this behaviour makes it easier to use in general
  • Add ability for useParcelForm() onChange to return promise, and changes are halted until resolve
    • subsequent submits are queued behind pending onChange
    • rejected onChanges are retried if other changes are submitted before all onChanges complete
    • if final onChange rejects, the ChangeRequest is pushed back down into the parcel buffer so editing can continue seamlessly
    • added an internal useParcelSideEffect() hook to do all the above
  • Add useParcelForm() onChangeUseResult option, so that the result of onChange can set the value in useParcelForm() state

react-dataparcels-drag

  • BREAKING CHANGE react-dataparcels-drag is used as a render props component rather than as a hoc. See docs for details on how to upgrade.

Hooks, validation finalisation, new docs

30 May 08:29
Compare
Choose a tag to compare

Addresses #196 #204 #215 #205 #213

Hooks are finally here!

dataparcels

  • BREAKING CHANGE Validation
    • Validation renamed to validation to match all other function exports
    • now exports a ParcelValueUpdater function rather than {modifyBeforeUpdate: Function}
    • now sets top level meta.invalidList
    • now doesnt validate until first attempted submit like most forms do
    • now blocks submit when used with useParcelForm and useParcelBuffer
  • Boundary splits are temporarily disabled, see dfcbd89
  • add Parcel.onChangeDOMCheckbox() #196
  • add Parcel.spreadDOMCheckbox() #196
  • use Object.is() in ChangeRequest.hasValueChanged() so NaNs are accurately tested for equality

react-dataparcels

  • add useParcelState hook (similar to ParcelHoc)
  • add useParcelBuffer hook (similar to ParcelBoundaryHoc)
  • add useParcelForm hook (new hook to provide pre-build form-like behaviours)
  • BREAKING CHANGE ParcelBoundary is now made out of useParcelBuffer
  • debugBuffer is gone
  • debugParcel is gone
  • onCancel is gone
  • onRelease is gone
  • modifyBeforeUpdate is deprecated, superseded by beforeChange, now accepts non-array functions
  • 2nd argument of childRenderer now gives a ParcelBufferControl, not a ParcelBoundaryControl
  • ParcelHoc and ParcelBoundaryHoc are deprecated
    • You're better off making an ad-hoc hoc out of the hooks you want

dataparcels-docs

  • Use dcme-gatsby #213
  • Refine a lot of pages #205
  • Add new API pages for hooks

Validator rule function receives topLevelValue

22 May 00:37
Compare
Choose a tag to compare
  • Give validators on fields at any depth access to the top level value
  • No breaking changes

Fix bug with modifyDown()

20 May 06:26
Compare
Choose a tag to compare

Originally done to be safe, modifyDown() was removing child data
so that the value returned from modifyDown()s updater and the existing
child data would be guaranteed to fit together. But given that
modifyDown() makes the end user (dev) promise not to change the shape,
then retaining child data is actually safe, as is more expected behaviour

Validator, modifyBeforeUpdate, ParcelBoundaryControl

22 Mar 01:33
Compare
Choose a tag to compare

Addresses #95, #100, #153, #183, #187, #188, #189, #198, #199

dataparcels

Validation

  • add dataparcels/Validation #183

Updater arguments

  • BREAKING CHANGE modifyDown(), update() and modifyUp() updaters are no longer passed Parcel as second argument.
  • add: modifyUp() updater is now passed ChangeRequest as second argument
  • add: modifyUp(shape()) updater is now passed ChangeRequest as second argument

Parcel and ParcelShape methods

  • BREAKING CHANGE: Parcel.toConsole() is removed
  • add Parcel.map() #199
  • add Parcel.metaAsParcel() #198
  • add ParcelShape.map() #199

Shape updater API alignment

  • BREAKING CHANGE: ParcelShape.updateShape() has been removed
    • use ParcelShape.update(shape(updater)) or ParcelShape.update(key, shape(updater)) instead
  • BREAKING CHANGE: ParcelShape.updateShapeIn() has been removed
    • use ParcelShape.updateIn(keyPath, shape(updater)) instead

ChangeRequest and Action API refinement

  • BREAKING CHANGE: ChangeRequest.updateActions() is removed #189
  • BREAKING CHANGE: ChangeRequest.changeRequestMeta is removed #189
  • BREAKING CHANGE: ChangeRequest.setChangeRequestMeta() is removed #189
  • BREAKING CHANGE: ChangeRequest.actions() is now ChangeRequest.actions #189
  • BREAKING CHANGE: ChangeRequest.toConsole() is removed #189
  • BREAKING CHANGE: Action.isValueAction() is removed #189
  • BREAKING CHANGE: Action.isMetaAction() is removed #189

ParcelBoundaryControl

  • BREAKING CHANGE: ParcelBoundary childRenderer 3rd argument "buffered" is moved to 2nd argument under a key of buffered #187
  • BREAKING CHANGE: ParcelBoundaryHoc childProps ${name}Actions is renamed to ParcelBoundaryHoc childProps ${name}Control #187
  • BREAKING CHANGE: ParcelBoundaryHoc childProps ${name}Buffered is removed
    • Can be found on ParcelBoundaryHoc childProps ${name}Control.buffered #187

Flow types

  • Fix flow types for ParcelShapeUpdater / ParcelShapeUpdateFunction

Logging

  • add: logging only works on production builds

Perf

  • Parcel caches children parcels #95
  • ChangeRequests now merge subsequent set actions #100

react-dataparcels

  • BREAKING CHANGE Remove ParcelBoundaryHoc.originalParcelProp
    • Use ${childProp}Control.originalParcel instead
  • BREAKING CHANGE rename keepState to keepValue and amend its behaviour
  • Add ParcelHoc.config.modifyBeforeUpdate
  • Add ParcelBoundary.props.modifyBeforeUpdate
  • Add ParcelBoundaryHoc.config.modifyBeforeUpdate
    • more work will be done to bring bundle size down. If you have dead code elimination in your build process then you should not receive any logging code.
  • add ParcelBoundary.props.onRelease and ParcelBoundary.props.onCancel
  • add ParcelBoundaryHoc.config.onRelease and ParcelBoundaryHoc.config.onCancel

dataparcels-docs

  • Add Validation, shape, CancelActionMarker to API docs
  • Add all examples and info necessary to finish the UI Behaviour page