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

function-resource refinements #538

Merged
merged 2 commits into from
Jun 19, 2022
Merged

Conversation

NullVoxPopuli
Copy link
Owner

@NullVoxPopuli NullVoxPopuli commented Jun 18, 2022

feat(function-resource): support encapsulated tracked state

This is based on ideas from https://wycats.github.io/polaris-sketchwork/reactivity.html
Where a function-based resource may return an arrow function instead
of a non-function-value. This allows the function-based resource to
conusme and update its own tracked state without invalidating itself.

Previously, in order for function-based resources to have their own
tracked state, an object had to be returned, and it was up to the
consumer to consume that tracked state via property access.

With this arrow-function return, we can provide a single reactive value
via the resource as well as encapsulated state.

@NullVoxPopuli NullVoxPopuli changed the title chore(internal): update implementation-detail comments function-resource refinements Jun 18, 2022
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 18, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 636e2bd
Status: ✅  Deploy successful!
Preview URL: https://3a134fef.ember-resources.pages.dev
Branch Preview URL: https://function-resource-refinement.ember-resources.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Jun 18, 2022

Estimated impact to a consuming app, depending on which bundle is imported

js min min + gzip min + brotli
/index.js 24.39 KiB 5.17 KiB 1.3 KiB 1.08 KiB
/core/index.js 4.21 KiB 1.89 KiB 898 B 763 B
/util/debounce.js 2.67 KiB 797 B 415 B 348 B
/util/ember-concurrency.js 5.39 KiB 1.6 KiB 748 B 635 B
/util/function-resource.js 11.69 KiB 3.06 KiB 1.16 KiB 974 B
/util/function.js 4.09 KiB 1.83 KiB 720 B 615 B
/util/helper.js 1.8 KiB 303 B 218 B 177 B
/util/map.js 5.83 KiB 2.48 KiB 1.02 KiB 878 B
/util/remote-data.js 5.01 KiB 1.83 KiB 705 B 618 B

@NullVoxPopuli NullVoxPopuli force-pushed the function-resource-refinements branch 3 times, most recently from 68a84f0 to a6e55af Compare June 19, 2022 01:12
This is based on ideas from https://wycats.github.io/polaris-sketchwork/reactivity.html
Where a function-based resource _may_ return an arrow function instead
of a non-function-value. This allows the function-based resource to
conusme and update its own tracked state without invalidating itself.

Previously, in order for function-based resources to have their own
tracked state, an object had to be returned, and it was up to the
consumer to consume that tracked state via property access.

With this arrow-function return, we can provide a single reactive value
via the resource as well as encapsulated state.
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review June 19, 2022 03:01
@NullVoxPopuli NullVoxPopuli merged commit 72a916f into main Jun 19, 2022
@NullVoxPopuli NullVoxPopuli deleted the function-resource-refinements branch June 19, 2022 03:01
@github-actions
Copy link
Contributor

🎉 This PR is included in version 4.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant