I tried to set invokeGetters
to true
at the begining of the function and the solution you described and sadly, none of them worked for me on my test app. I got the same error with both tries: TypeError: this.getArrayObserver(...) is undefined
from aurelia-binding.js:4814
.
This relates to your bindable decorator right? Or did you talk about the original first posts sample?
No, I removed all that to use the standard decorator.
Iâve just tried the basic counter inc Sample and it worked with the mentioned fix. Couldnt see any console errors any longer. Maybe you can share your articles sample so we can tweak that a bit together to see where the issue is
I updated the code on the gitlab repo. I included mocked data to make the app usable as is.
- I get the data in the TTRSS service
- I set the data in the store in the
receivedUnreadArticles
action - I use the
markedAsRead
action to update the read status on the article. - I get the articles in the home route
- And I display them with the aurss-article component.
Steps to reproduce issue:
git clone https://gitlab.com/Jenselme/aurss.git
git checkout feat/use-immerjs-with-aurelia-store
yarn
yarn start
- Open http://localhost:8080/
Now if you click on Mark as read, youâll get Unhandled rejection Error: Immer drafts cannot have computed properties
before the modification on immerjs and TypeError: this.getArrayObserver(...) is undefined
after.
If you need anything else, let me know.
@Jenselme I cloned this repo and I get the same as you concerning the array observer.
I tried a lot of different things as binding to an array that is modified by immer is working in my app. Finally, I commented out
if.bind=âarticles.length === 0â>No unread article.
in home.html.
No more error. So itâs the if.bind on the articles causing the issue, not the repeat.for.
Is this news to you?
well that might be actually a sideeffect from dropping the observers.
If in @Jenselmeâs example instead of commenting out what you mentioned @swalters I do fixup the subscription in home.ts -> bind to be
.subscribe(((articles) => { this.articles = [...articles]; }));
itâs all good, except that you still get all articles, not sure if business logic is wrong here or again another issue.
@zewa666 but it was still bound to articles in the repeat-for. I only removed 1 of 2 template items bound to articles. Itâs a weird error for sure.
Yeah but it seems there is a logical issue because I cant find any location where it filters to show only read===false.