mlandauer / thats-camping-elm

Find campsites near you
https://thatscamping.org
GNU General Public License v3.0
5 stars 1 forks source link

When following link from outside world directly to campsite detail page get 404 for a long time #103

Open mlandauer opened 7 years ago

mlandauer commented 7 years ago

Now that we have Google indexing https://thatscamping.org it's very likely that a person who's never visited the site before will go directly to a campsite detail page.

Their current experience is:

Obviously a terrible experience.

What would be better is if on a campsite detail page, the campsite data gets loaded as soon as possible. A few different ways that we could do this:

  1. After elm has taken control: Directly load the campsite data from the remote database. Then allow the synching of the databases to take over.
    • Advantage: Simple and not adding more code on the javascript side
    • Disadvantage: We get a flash of 404 (or loading)
  2. Before elm has taken control: See that we're on a campsite detail page and directly load the campsite from the remote database. Then, hand over to elm.
    • Advantage: There will no 404 (or loading) visible to the user at all.
    • Disadvantage: We need to have logic to recognise routes on the javascript side.
  3. Before elm has taken control: If there is no local database, then load all the campsites directly from the remote database. Then, hand over to elm.
    • Advantage: Simple and no flash of 404 for the user.
    • Disadvantage: Slower than option 2
mlandauer commented 7 years ago

Another option is for the server to send back to the client (alongside the static html), a command or indication of what data the client needs to load.

mlandauer commented 7 years ago

Related to #85

mlandauer commented 7 years ago

Implemented option 3 in https://github.com/mlandauer/thats-camping-elm/commit/fed4b588cdc53670b885e59be644b52dcb7e4e58. Let's see how that works in practise before deciding whether that's good enough and whether to close this ticket.