Closed paulik123 closed 3 years ago
Hmm, I'll see if I can replicate this. I'm assuming that this is one of django's generic views, ie not a plain template view. So this PR > https://github.com/jonathan-s/django-sockpuppet/pull/124 should at least reduce the amount of times get_context_data
is called by one.
@paulik123, If you've got an open source django repo where I can try this out that would make it a whole lot easier to see what's up.
I added you to my private repo. Also, here's a video showing the behaviour
@paulik123, that was an excellent video. Do you think you could check the browser console as well? Do you get any errors there?
Nothing besides some warnings. I also have
reflexError(element, reflex, error) {
console.log(element, reflex, error)
}
inside my controller and it doesn't get called. It's very strange. I solved the problem by just removing that line, but I was curios about what's causing it.
@paulik123 I've verified that the issue is solved by #124, meaning that it is now showing the exception as expected. So I'm going to go ahead and close this now.
I encountered this very weird issue. In get
get_context_data
I had this situation. Instead ofcache.get_or_set()
I mistakenly wrotesession.get_or_set()
. Django showed no error, neither thereflexError
method in the JS controller was called, but get_context_data was called 3 times in row only by doing one reflex.Here is the relevant code:
Here's the print output when I trigger a reflex:
No error is shown and get_context_data is called 3 times. 2 times with context['stimulus_reflex'] == True and one time False. I've watched the network tab in Developer tools and no other http requests are made.
Now for the really weird part:
OUTPUT:
I still don't know why get_context_data gets called 3 times but at least an error is shown.
I'll reply promptly if you need more info. Thank you.
django-sockpuppet==0.6.0 Django==3.2.4 Python=3.8