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

Feature/hooks reorganised #219

Merged
merged 32 commits into from
May 30, 2019

Conversation

dxinteractive
Copy link
Collaborator

@dxinteractive dxinteractive commented May 20, 2019

Addresses #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

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

@dxinteractive dxinteractive force-pushed the feature/hooks-reorganised branch from aa3a813 to ca1dce7 Compare May 20, 2019 14:20
@dxinteractive dxinteractive force-pushed the feature/hooks-reorganised branch from ca1dce7 to 368bd7c Compare May 21, 2019 13:08
@dxinteractive dxinteractive force-pushed the feature/hooks-reorganised branch from 5faa66e to 05f784d Compare May 22, 2019 10:06
- now exported full lowercase (validation, not Validation)
- now returns a parceldata updater directly, instead of an object
  with a modifyBeforeUpdate function on it
- now falsifies any meta._submit keys. this will be used by
  useParcelBuffer prevent submission of invalid forms
@dxinteractive dxinteractive force-pushed the feature/hooks-reorganised branch 2 times, most recently from 5605c2a to aab5c08 Compare May 28, 2019 03:45
parcels know of each others existence via the registry, which each
parcel adds itself too. this is so even parcels that havend re-rendered
in forever can have a reference to the newest version of their parent
parcel. boundary splitting is making sure that when a parcel boundary
is used, that they each have their own registry, so parel boundaries
dont accidentally share updates telepathically between each other.

right now this is a tad broken with hooks. ill fix it soon, but the
frequency that we'll hit this (i.e. never) means id rather uncover
this logical hole for a bit to get hooks out
rather than an object with a modifyBeforeUpdate function on it
it can also now block submit actions (where submit actions use
meta._submit like upcoming useParcelBuffer does), and also not show
errors until a submit attempt has been made
a few breaking changes here, will be documented in the pr
@dxinteractive dxinteractive force-pushed the feature/hooks-reorganised branch from ff9c533 to a6c273c Compare May 29, 2019 13:54

const internalBuffer = useParcelBufferInternalBuffer({
onReset: () => setOuterParcel(null),
// ^ resets by ecreating innerParcel from outerParcel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@dxinteractive dxinteractive merged commit 72a7e3c into release/crazy-constrictor May 30, 2019
@dxinteractive dxinteractive deleted the feature/hooks-reorganised branch May 30, 2019 08:18
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.

2 participants