ember-learn/ember-cli-addon-docs

`<DocsHeader::SearchBox />` component throws error with newer version of `ember-data`

barryofguilder opened this issue · 6 comments

I created a V2 addon and am using a full Ember app for my docs. The Ember app is using ember-data 4.9.1. When I install ember-cli-addon-docs, I get an error when running the docs app. I do want to mention that if I create a V1 addon, the same outcome happens, so it doesn't seem to be tied to V2 at all.

Screenshot 2023-02-25 at 12 08 42 PM

If I downgrade ember-data to 4.7.3, the error goes away. I've narrowed it down to when the constructor calls the fetchProject task in the <DocsHeader::SearchBox /> component (here). If I add a try/catch around the call, it will throw an error and get swallowed, and the app works. I'm not sure why it's throwing an error.

Screenshot 2023-02-25 at 1 42 58 PM

Here's a bare bones GitHub repository reproducing the issue. I've added all the steps in the README file for what I did and which versions of ember-data don't work.

I bet this is another case of tracked data changing during render.
in fetchProject, if you add yield Promise.resolve() above the findRecord, is the error resolved?

I bet this is another case of tracked data changing during render. in fetchProject, if you add yield Promise.resolve() above the findRecord, is the error resolved?

When I do that, the page renders, but the error is still thrown. And once that error is thrown, the app stops working. If I put a debugger; directly below the yield Promise.resolve(), I don't have an error yet, but hitting the findRecord still throws the error.

@barryofguilder this looks like the same issue as emberjs/data#8439, could you please confirm if this still happens with latest ember-data?

@barryofguilder this looks like the same issue as emberjs/data#8439, could you please confirm if this still happens with latest ember-data?

It looks like I don't get the error anymore for Ember Data 4.11.3! I tried 4.11.2 and the error is there, so it looks like 4.11.3 is the magic version.

@barryofguilder going to close as the root cause of the issue was fixed. feel free to reopen if issue persists.