Fork me on GitHub
#fulcro
<
2024-02-17
>
Eric Dvorsak09:02:04

One downside of the lisp extraction method for strings https://github.com/fulcrologic/fulcro-i18n/blob/main/I18N.adoc#extracting-strings-lisp-method is that it won't extract the strings from the dependencies unlike the js method

tony.kay17:02:54

Ah, good point, though I would expect it to be a common case for all user-visible strings to come from your project.

Mark Wardle15:02:24

Hi all. Would it be reasonable to stash a sequence of transactions within the app database to be executed in the event of browser-driven routing such as when the user clicks forward or back? I have HTML5 routing which internally simply calls dynamic routing. However, if the user carries out some complex task within a single page, in, for example, a modal dialog or workflow - if they click BACK, they may leave that component in an inconsistent state. When I only used dynamic routing, this was easy as I could prevent route changes - usually by not showing the buttons in the user interface that would allow navigation - but dynamic routing also has the hook :allow-route-change? as well. Now I think there is benefit from allowing users to click BACK and FORWARD, particularly when pages are read-only, and I can do clever landing pages from other applications for integration purposes, and it is nice for users not to completely lose the application if they accidentally hit "BACK" in the browser. Are there any recommended approaches to making the best use of HTML routing while handling the complexity of state?

tony.kay17:02:49

I would think of it as a global concern since the HTML5 history and events are global. There is only one history and back button. So, I would tend to centralize the logic around that component of the architecture. So, I’d make wrapper functions around any code I invoke to change routes (if necessary) that also manipulate this global component.

Mark Wardle22:02:19

Ah of course. That makes sense. My route-to! function can do anything it wants. And that answers my other question too! Toggle true and then only show errors if visited, an error AND not routing. Thank you!

Mark Wardle15:02:16

Sorry for another question - here is a little video showing that because a text field is focused automatically, and when focus is lost, form state validation is applied, that one gets a flash of a form error just prior to routing. The logical fix is to recognise when routing is starting and don't show validation errors. Is there an easy way to achieve this? Grateful for any advice. It isn't a major issue and purely cosmetic of course.

tony.kay17:02:03

Add something stateful to disable blur handling (e.g. in Fulcro state? Or even in the app itself) that you can toggle true during routing, and then rewrite the controls to ignore blur when that is true? I don’t see an easy way, really, but at least that isn’t intractable.

Mark Wardle22:02:02

Thanks! Makes a lot of sense and explicit - no magic involved.