You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behaviour
So far we didn't need any special way to handle e.g. image urls in our Elm app, because we could hardcode it in Constants.elm. Right now, the urls depend on the environment, so we need to change our functions accordingly:
If we were to evaluate the urls lazily (exactly when we need them), that would actually mean that we need to pass Location to our View (which doesn't seem very comfortable). My suggestion here is to approach it in another way:
Let's say we're adding an inbox page that would display messages from other players.
We would create a special type that would represent the record with all the data needed for this module's Update, View etc. Let's call this type inboxDataType.
We would add this type as a new part of our general Model
Once initializing the whole model, we would just pass the location once and then save all the urls in this module's record
Now we would only need to pass our instance of inboxDataType to the Update/View functions of this module and we could take already evaluated urls without the need of computing them again (no need to pass Location around).
Motivation / use case
no need to pass the Location around
possible improvement in app's speed (no need to compute the url with every call to update/view)
possible downside -> more memory consumed
@pmrukot@jtkpiotr let me know if this approach seems reasonable for you. I think we could use this in #56.
The text was updated successfully, but these errors were encountered:
Type
Question
Current behaviour
So far we didn't need any special way to handle e.g. image urls in our Elm app, because we could hardcode it in Constants.elm. Right now, the urls depend on the environment, so we need to change our functions accordingly:
If we were to evaluate the urls lazily (exactly when we need them), that would actually mean that we need to pass Location to our View (which doesn't seem very comfortable). My suggestion here is to approach it in another way:
Let's say we're adding an inbox page that would display messages from other players.
Motivation / use case
@pmrukot @jtkpiotr let me know if this approach seems reasonable for you. I think we could use this in #56.
The text was updated successfully, but these errors were encountered: