Giter Club home page Giter Club logo

Comments (7)

MartinMystikJonas avatar MartinMystikJonas commented on June 24, 2024 1

Main problem here is that actionX does not always continue renderX. Rendering view X by renderX after actionX is default but actionX can freely choose what view it will render.

from application.

dg avatar dg commented on June 24, 2024

I mean, the documentation says render<View>() OR action<Action>()

from application.

peterpp avatar peterpp commented on June 24, 2024

Yes, but human language is not a programming language with short-circuit evaluation. I have a black and white pencil and I say you: Choose black pencil or white pencil. Do I mean that you can't choose white pencil?

However, It is still quite unexpected and vulnerable to easily broke the application.

from application.

dg avatar dg commented on June 24, 2024

Do you have any suggestions on how to improve the documentation text?

from application.

peterpp avatar peterpp commented on June 24, 2024

I see that you are refusing to even consider or discuss that the code itself could be potentially improved and help developers to make less mistakes and keep their code simpler.

Documentation proposal:

At the same time, all parameters specified in the signature of the action<Action>() method or render<View>() method, if the action<Action>() is not defined, are transferred.

In Czech:

Zároveň se přenáší i všechny parametry uvedené v signatuře metody action<Action>() nebo metody render<View>(), pokud není action<Action>() definovaná.

from application.

dg avatar dg commented on June 24, 2024

I'm certainly not opposed to improvements, but I can't immediately think of a better way to do it, and at the same time, you're the first person in 15 years to deal with this, so I'm not seeing it as a priority. Even in light of the fact that I don't want to make BC breaks.

from application.

peterpp avatar peterpp commented on June 24, 2024

I understand such a change would be BC break and the priority is low. I also understand that creating unified signature for both actionX and renderX methods would be problematic – parameters can have different order, the same parameter can be optional in the first method and required in the second, they even can have different types theoretically.

What I do right now, is keeping parameters in both methods identical. Together with warning in comment to remind me that I have to keep parameters always the same. To be honest, after years of development in Nette, I'm quite tired of doing it this way. In one case, I have 10 parameters in actionX method and none of them are actually used. They are required just to force framework to create links properly.

Another solution is to write all parameters in template explicitly like this:

<a n:href="this param1 => true, param2 => true">refresh</a>

Not cool. In this approach I have to think about it in every single usage.

So let me propose another solution. I can imagine the setting that will control parameters rendering (in a similar way how autoCanonicalize can be changed). This setting will have options:

  • preferActionParams (default, current behavior)
  • preferRenderParams (much more useful in real scenarios, in my opinion)
  • unifyParams (universal, but maybe too complicated to implement)

from application.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.