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

solid-primitives destructure: Added new config option "normalize" #525

Closed
wants to merge 17 commits into from

Commits on Oct 9, 2023

  1. Update index.ts - "smart" option to normalize returned values

    Added new config option "smart"
    If true all values will be returned as reactive functions, meaning it will resolve values of type MaybeAccessor<T>  to Accessor<T>.
    This helps a lot for library devs to provide a flexible interface to users and don't worry about having to make breaking changes later on and the handling of the destructured props is always as Accessor.
    About the naming feel free to rename it to anything you like.
    I was thinking about:
    normalize
    normalizeValues
    accessibleValues
    ...
    Maybe it would also make sense to make this the default behavior, but that would be a breaking change.
    madaxen86 authored Oct 9, 2023
    Configuration menu
    Copy the full SHA
    d43a7ab View commit details
    Browse the repository at this point in the history
  2. Update index.ts - "smart" option to normalize returned values

    Added new config option "smart"
    If true all values will be returned as reactive functions, meaning it will resolve values of type MaybeAccessor  to Accessor.
    This helps a lot for library devs to provide a flexible interface to users and don't worry about having to make breaking changes later on and the handling of the destructured props is always as Accessor.
    About the naming feel free to rename it to anything you like.
    I was thinking about:
    normalize
    normalizeValues
    accessibleValues
    ...
    Maybe it would also make sense to make this the default behavior, but that would be a breaking change.
    madaxen86 committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    db9a9da View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ff9b2b9 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    5c37513 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    484827d View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. optimized the normalize options

    it will now return all functions as they are and only memo static values.
    What I have realized is that once normalized is set to true, it doesn't matter if memo is true or false. The results are the same. So I decided to make it an option of memo.
    And instead of using exclusive types for the normalize config I extended the existing types to return a different type depending on the memo option.
    madaxen86 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    da64266 View commit details
    Browse the repository at this point in the history
  2. patch -> minor

    thetarnav authored Oct 26, 2023
    Configuration menu
    Copy the full SHA
    c693954 View commit details
    Browse the repository at this point in the history
  3. documented option in Readme.md

    added myself as contributor in package.json
    madaxen86 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    150b1df View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8cf7040 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    15438fc View commit details
    Browse the repository at this point in the history
  6. adjustments according @thetarnav's comments

    I have added tests to check for the combination of {normalize:true} vs {normalize:true,memo:true}
    removed the check for memo in the getter function.
    Moved the check if source is a function outside the getter but it still needs to be a function, otherwise tests fail. Wrapped it in a memo for optimization.
    madaxen86 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    6cd141e View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2023

  1. Update packages/destructure/src/index.ts

    Co-authored-by: Damian Tarnawski <[email protected]>
    madaxen86 and thetarnav authored Oct 28, 2023
    Configuration menu
    Copy the full SHA
    9717358 View commit details
    Browse the repository at this point in the history
  2. corrected returned type for normalized option.

    splitted tests for normalize
    madaxen86 committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    98f999e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2159512 View commit details
    Browse the repository at this point in the history
  4. removed unused imports

    madaxen86 committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    4d0e264 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2023

  1. Configuration menu
    Copy the full SHA
    f4eb72f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b56f253 View commit details
    Browse the repository at this point in the history