neutronX / django-markdownx

Comprehensive Markdown plugin built for Django
https://neutronx.github.io/django-markdownx/
Other
863 stars 153 forks source link

Requests are made to the rendering enpoint when the field is empty #78

Closed umazalakain closed 3 years ago

umazalakain commented 7 years ago

This results in many useless requests (like in the case of formsets).

xenatisch commented 7 years ago

I have no idea what you're talking about... Care to elaborate? Maybe an example? Some description of where you think the problem lies? What you have been trying to do? Whether this is a bug or a suggestions?

I mean you have given us no context whatsoever!

umazalakain commented 7 years ago

Sorry about that.

The testapp renders a markdownx field with no content which makes a request to the rendering endpoint (/markdownx/markdownify/ in this case). This isn't a bug in itself, but it results in many useless requests whenever a form or formset with many empty markdownx fields gets rendered.

The js library could check if the input being rendered is empty, and only make rendering requests if it's not. It would maybe also be interesting to have some kind of parameter which tells the library whether the user wants to make the initial rendering requests, or only make requests once an input is modified.

xenatisch commented 7 years ago

Well, the testapp is pretty much in its infancy, and it's pretty much dealt with by @adi- .

We really ought to work on it more, but no one seems to be willing to go down that route and commit to it, even so it's fairly important.

But the recommendation on JS is a good one, and I'm working on it some minor refinements + more comprehensive docs. So it's as good a time to make changes there as it'll ever be, one should suppose as they say.

As for initial rendering requests, that's something we need to give more thoughts to; but any suggestions are welcome.