-
Notifications
You must be signed in to change notification settings - Fork 126
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
Commits on Oct 9, 2023
-
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.
Configuration menu - View commit details
-
Copy full SHA for d43a7ab - Browse repository at this point
Copy the full SHA d43a7abView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for db9a9da - Browse repository at this point
Copy the full SHA db9a9daView commit details -
Configuration menu - View commit details
-
Copy full SHA for ff9b2b9 - Browse repository at this point
Copy the full SHA ff9b2b9View commit details
Commits on Oct 11, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5c37513 - Browse repository at this point
Copy the full SHA 5c37513View commit details -
Configuration menu - View commit details
-
Copy full SHA for 484827d - Browse repository at this point
Copy the full SHA 484827dView commit details
Commits on Oct 26, 2023
-
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.
Configuration menu - View commit details
-
Copy full SHA for da64266 - Browse repository at this point
Copy the full SHA da64266View commit details -
Configuration menu - View commit details
-
Copy full SHA for c693954 - Browse repository at this point
Copy the full SHA c693954View commit details -
documented option in Readme.md
added myself as contributor in package.json
Configuration menu - View commit details
-
Copy full SHA for 150b1df - Browse repository at this point
Copy the full SHA 150b1dfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8cf7040 - Browse repository at this point
Copy the full SHA 8cf7040View commit details -
Configuration menu - View commit details
-
Copy full SHA for 15438fc - Browse repository at this point
Copy the full SHA 15438fcView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 6cd141e - Browse repository at this point
Copy the full SHA 6cd141eView commit details
Commits on Oct 28, 2023
-
Update packages/destructure/src/index.ts
Co-authored-by: Damian Tarnawski <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9717358 - Browse repository at this point
Copy the full SHA 9717358View commit details -
corrected returned type for normalized option.
splitted tests for normalize
Configuration menu - View commit details
-
Copy full SHA for 98f999e - Browse repository at this point
Copy the full SHA 98f999eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2159512 - Browse repository at this point
Copy the full SHA 2159512View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4d0e264 - Browse repository at this point
Copy the full SHA 4d0e264View commit details
Commits on Oct 29, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f4eb72f - Browse repository at this point
Copy the full SHA f4eb72fView commit details -
Configuration menu - View commit details
-
Copy full SHA for b56f253 - Browse repository at this point
Copy the full SHA b56f253View commit details