history.nette.ajax.js
history.nette.ajax.js copied to clipboard
How to disable markForward for ErrorPresenters?
I'm using module-specific error presenters and sometimes I use forward method to send the exception from the module-specific ErrorPresenter to default one. However this triggers this line which fails to generate the link because Exception and Request are objects. I need this addon to ignore forwadding between to ErrorPresenter somehow. Not completely sure how though.
Here is a draft of a new verion which is more simple and fixes this issue. What do you think about it?
https://gist.github.com/enumag/cea679af2e6349037507
(Note that I didn't test it yet. It is probably missing some use statements etc.)
I've stopped using the PHP part of this extension because I don't like what it does. Closing.
@enumag I think that's alright, as you can still provide correct information to JS part on your own. Have you struggled with some other issues beside this one, that led you to this decision?
@vojtech-dobes The main reason is that I don't like your hacking of Application where you put new HttpRequest inside it. Since HttpRequest is a service, other services that are using it may not work correctly because they would still have the old HttpRequest. Also the else branch is basically making redirect out of forward method which I don't like either. When I want to change URL I use redirect, when I don't I use forward.
@vojtech-dobes I had to dig into this issue a little bit more but I still don't understand the reason why the redirect property is added to payload when a forward happens. The JS part changes the URL but why do that? I mean normal forward (without ajax) doesn't change the URL.
I've some suggestions but I need to know the reasoning behind this first.
@vojtech-dobes Also I think trying to replace the HttpRequest on redirect is useless. Do you have a reason to do that? We can just use Application::processRequest().