RooSoft

RooSoft

Navigate to new page, sending some rather large info

Could it be possible to use a <.link> in a LiveView page, and include data that has to make it to the next page?

Thing is, the current page could be selecting stuff that’s too large to fit into an URL… I’d like the next page to get that info, maybe via the HTTP body or something…

What’s the best way to achieve this?

Marked As Solved

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

+1. I think the whole show/new/edit/etc paradigm is a good one to get going, but as you figure out the workflows that your users actually need to do I’m a big fan of just building those workflows where they make sense. If people want to go look at a transaction and seamlessly initiate a new transaction then I say put a form on show to make it easy.

Also Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

It sort of sounds like you’re building one, so you could consider leaning into it. Maybe make the new thing a modal?

Stepping back to the link thing: Are you making a new transaction out of some sub-set of the outputs? Could you “compress” the information by, instead of sending the full 64 bytes instead send the “index” of the output? Eg if you have

Transaction-id: long-thing
outputs:
really-long-thing-1
really-long-thing-2
really-long-thing-3
really-long-thing-4

and you want to make a new transaction based on long thing 1 and long thing 4 you could put the transaction ID in the URL, and then just the indexes of those other values [0, 3]. The hashes are all sortable, and the transaction is immutable, so the combination of the transaction and the indexes should be deterministic. This should dramatically increase how many things can fit in your URL.

Of course your final option here I suppose is to use send_event to push a message to JS, and have the JS shove the data in local storage keyed off the transaction id.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Gotcha. Does the link need to take them to a totally different live_view or could it be a patch? You could have the selection content be a component with a form or something, and then when you submit that form, the liveview can hold onto that data in its state, and then render the next “step” of the form, and save the chosen contents in a hidden form field or just in its process state.

RooSoft

RooSoft

You are right to think that those 64 byte hashes can be reduced to an index… they always show up in the same order in a given transaction. That would make it possible to potentially create a querystring carrying that info in a pretty compact way. Still, somebody made a crazy transaction with ~1000 inputs a couple of weeks ago, and that would still break the ~2000 bytes URL size limit with the concept we’re talking about.

I will sleep on this, the idea of a wizard could also be a good one… I am just keeping the focus on the least amount of operations to get the job done, so most users end up thinking it feels natural.

Thank you ben, you help is very enlightening!

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call t...
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement