[PR #4746] [CLOSED] basic support for permanent url in gallery view #10502

Closed
opened 2026-02-05 14:23:04 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/4746
Author: @szethh
Created: 10/31/2023
Status: Closed

Base: mainHead: feat/permanent-url-pics


📝 Commits (4)

  • c2f908f rewrite using url params
  • caaf442 Merge branch 'main' of github.com:immich-app/immich into pr/szethh/4746
  • e298cca conditional statement formatting
  • aa36c3e close asset viewer only when creating album from asset

📊 Changes

3 files changed (+43 additions, -2 deletions)

View changed files

📝 web/src/lib/components/asset-viewer/asset-viewer.svelte (+4 -0)
📝 web/src/lib/components/photos-page/asset-grid.svelte (+39 -0)
📝 web/src/routes/(user)/albums/[albumId]/+page.svelte (+0 -2)

📄 Description

An attempt at persisting the picture ID in the url. Related: #2690 #2906

It's built around the assetViewingStore. When the presented asset changes, the app will redirect to /photos/{assetId}. It is a client-side redirect, so no state is lost.
There is another listener that redirects back to /photos once the asset viewer is closed (clicking the 'x', pressing escape...)

When navigating to /photos/{assetId}, the path param is used to populate the asset viewer, if not set beforehand. This supports refreshing the page, and getting the same picture (and context!) back.

Navigation with the arrow keys / arrow buttons is unaffected.

The problem is that, to avoid loss of state when navigating to and from the pages, the main logic of /photos now resides on a layout. Essentially, renamed +page.svelte to +layout.svelte, and added a <slot /> at the end. Ditto with +page.server.ts. +page.svelte is now an empty file. The UI behavior is the same.
I am not totally sure how we could go about changing the url AND keeping a +page.svelte intact.

For now this only works on /photos, since it's a proof of concept and I'm not sure if the layout thing is the best way to go. I'm completely new to this project so I might've missed something :D


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/4746 **Author:** [@szethh](https://github.com/szethh) **Created:** 10/31/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/permanent-url-pics` --- ### 📝 Commits (4) - [`c2f908f`](https://github.com/immich-app/immich/commit/c2f908f329e13240d7b0f460e9279ac3651c3a33) rewrite using url params - [`caaf442`](https://github.com/immich-app/immich/commit/caaf442cc8f7b3b97913bb7d8aa69f4bfb0df969) Merge branch 'main' of github.com:immich-app/immich into pr/szethh/4746 - [`e298cca`](https://github.com/immich-app/immich/commit/e298ccab94244fbbabd0d2085cba3c6dd3fe5e27) conditional statement formatting - [`aa36c3e`](https://github.com/immich-app/immich/commit/aa36c3e8e84cb114861c9ff34f65293d9d208fe1) close asset viewer only when creating album from asset ### 📊 Changes **3 files changed** (+43 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `web/src/lib/components/asset-viewer/asset-viewer.svelte` (+4 -0) 📝 `web/src/lib/components/photos-page/asset-grid.svelte` (+39 -0) 📝 `web/src/routes/(user)/albums/[albumId]/+page.svelte` (+0 -2) </details> ### 📄 Description An attempt at persisting the picture ID in the url. Related: #2690 #2906 It's built around the `assetViewingStore`. When the presented asset changes, the app will redirect to `/photos/{assetId}`. It is a client-side redirect, so no state is lost. There is another listener that redirects back to `/photos` once the asset viewer is closed (clicking the 'x', pressing escape...) When navigating to `/photos/{assetId}`, the path param is used to populate the asset viewer, if not set beforehand. This supports refreshing the page, and getting the same picture (and context!) back. Navigation with the arrow keys / arrow buttons is unaffected. The problem is that, to avoid loss of state when navigating to and from the pages, the main logic of `/photos` now resides on a layout. Essentially, renamed `+page.svelte` to `+layout.svelte`, and added a `<slot />` at the end. Ditto with `+page.server.ts`. `+page.svelte` is now an empty file. The UI behavior is the same. I am not totally sure how we could go about changing the url AND keeping a `+page.svelte` intact. For now this only works on `/photos`, since it's a proof of concept and I'm not sure if the layout thing is the best way to go. I'm completely new to this project so I might've missed something :D --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:23:04 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#10502