EmilStenstrom / django-components

Create simple reusable template components in Django.
MIT License
953 stars 59 forks source link

Async middleware #464

Closed TheSteveBurgess closed 2 weeks ago

TheSteveBurgess commented 2 weeks ago

Hi,

Are there any plans to implement async in the current middleware? At the moment using the django-components middleware forces the entire request pipeline to be sync as the middleware doesn't support a async.

Cheers,

Steve.

JuroOravec commented 2 weeks ago

Hey @SteveBurgessStantec, I don't see why not. From the docs, it looks like making an async copy of the ComponentDependencyMiddleware middleware should do the trick.

Do you have a project that uses async middlewares? Could you hack together a PR and check if things work for you? Or alternatively some demo project that we could use for testing. I think demo project in this repo is synchronous, and so is the project where I use django-components, so I don't have a quick way to test if things work.

TheSteveBurgess commented 2 weeks ago

Hey @JuroOravec I converted it earlier in dev and its looks like its working fine :)

Let me just check internally and see if i'm allowed to share the code. If i get the OK I'll create a PR.

TheSteveBurgess commented 2 weeks ago

I've created the PR now (i think!). You'll have to excuse me, it's been a very long time since I've created pull requests on Github :)

Let me know if you need anything from me.

JuroOravec commented 2 weeks ago

Merged in https://github.com/EmilStenstrom/django-components/pull/466

JuroOravec commented 2 weeks ago

Released as part of 0.70 🎉