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

Bugfix: drop context and stop caching TrackedAsyncData #578

Merged
merged 7 commits into from
Mar 15, 2023
Merged

Conversation

chriskrycho
Copy link
Collaborator

  • We had a race condition with the existing waiter teardown, because of an additional, unnecessary, teardown we had in the destructor.

  • Considering this also highlighted that we did not need the cache of Promises to TrackedAsyncData. The cache had some non-trivial overhead, and it also risked leaking if anything held onto a strong reference to the Promise.

This is breaking, technically, but is a high-urgency fix so we are treating it as a bugfix.

- We had a race condition with the existing waiter teardown, because of
  an additional, unnecessary, teardown we had in the destructor.

- Considering this also highlighted that we did not need the cache of
  `Promise`s to `TrackedAsyncData`. The cache had some non-trivial
  overhead, and it also risked leaking if anything held onto a strong
  reference to the `Promise`.

This is *breaking*, technically, but is a high-urgency fix so we are
treating it as a bugfix.
@chriskrycho chriskrycho added the bug Something isn't working label Mar 15, 2023
This also lets us switch to a function-based helper; in the future at
2.0 we can switch to just using a function, and we can document just
using the function as the recommended path for `<template>`.
@chriskrycho
Copy link
Collaborator Author

@SergeAstapov I updated, mind taking another gander?

@chriskrycho
Copy link
Collaborator Author

…also I'll figure out why type checking is failing.

- Get rid of the `context` param.
- For function-based `load`, update the expected type. This is
  indicative: we *really* want to switch to just using the normal
  function-based helper.
@SergeAstapov
Copy link
Collaborator

@chriskrycho looks like two more places in readme missing:

return new TrackedAsyncData(this.store.findRecord('user', userId), this);
return load(this.store.findRecord('user', this.args.id), this);

otherwise looks good!

@chriskrycho
Copy link
Collaborator Author

Ah, good! Fixed, thanks. Will enable auto-merge.

@chriskrycho chriskrycho merged commit f07fc87 into main Mar 15, 2023
@chriskrycho chriskrycho deleted the context-fix branch March 15, 2023 18:25
@chriskrycho
Copy link
Collaborator Author

Done and out as 1.0.1. Thanks again for the speedy reviews @SergeAstapov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants