jonathan-s / django-sockpuppet

Build reactive applications with the django tooling you already know and love.
https://github.com/jonathan-s/django-sockpuppet
MIT License
450 stars 22 forks source link

A reflex can access the context of the view it came from #72

Closed jonathan-s closed 3 years ago

jonathan-s commented 3 years ago

Type of PR (feature, enhancement, bug fix, etc.)

Feature.

Description

It may be desirable for a reflex to access the context of the view it came from. This feature provides a way for reflexes to be able to access that.

Why should this be added

Not being able to access the context from the view it came from can make it difficult to set up certain things in the reflex.

Checklist

jonathan-s commented 3 years ago

@JulianFeinauer you may be interested in seeing this.

jonathan-s commented 3 years ago

@JulianFeinauer Any preference in terms having this be a function or a property?

JulianFeinauer commented 3 years ago

Just one thing that came to my mind. With this setup... The context could be evaluated multiple times (at least 2 if you access it in the reflex, or)?

jonathan-s commented 3 years ago

The context could be evaluated multiple times (at least 2 if you access it in the reflex, or)?

That is indeed correct. We could do better here.

JulianFeinauer commented 3 years ago

We could simply store it the first time we evaluate it and always return that then, or?