Extend story publish to include sessions - #41
Merged
Conversation
dsehnal
reviewed
Aug 14, 2025
| } | ||
|
|
||
| async function saveStoryWithJSON( | ||
| async function saveStoryWithFormData( |
Member
There was a problem hiding this comment.
Suggested change
| async function saveStoryWithFormData( | |
| async function saveStory( |
Comment on lines
29
to
+32
| const sessionId = searchParams.get('sessionId'); | ||
| const sessionUrl = searchParams.get('sessionUrl'); | ||
| const templateName = searchParams.get('template'); | ||
| const sessionType = searchParams.get('type') as 'session' | 'story' | null; |
Member
There was a problem hiding this comment.
Suggested change
| const sessionId = searchParams.get('sessionId'); | |
| const sessionUrl = searchParams.get('sessionUrl'); | |
| const templateName = searchParams.get('template'); | |
| const sessionType = searchParams.get('type') as 'session' | 'story' | null; | |
| const sessionId = searchParams.get('session-id'); // please rename this across the app. The - version looks nicer | |
| const publishedSessionId = searchParams.get('published-session-id'); | |
| const sessionUrl = searchParams.get('session-url'); // we could allow loading from any hosted session with CORS | |
| const templateName = searchParams.get('template'); |
Comment on lines
+34
to
+37
| if (sessionUrl) { | ||
| loadSessionFromUrl(sessionUrl); | ||
| return; | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| if (sessionUrl) { | |
| loadSessionFromUrl(sessionUrl); | |
| return; | |
| } | |
| const url = sessionUrl ?? resolvePublishedSessionUrl(publishedSessionId ); | |
| if (url) { | |
| loadSessionFromUrl(url); | |
| // TODO: clear session-url and published-session-i | |
| return; | |
| } |
Comment on lines
+44
to
+52
| if (sessionType) { | ||
| try { | ||
| const url = new URL(window.location.href); | ||
| url.searchParams.delete('type'); | ||
| window.history.replaceState({}, '', url.toString()); | ||
| } catch (error) { | ||
| console.warn('Failed to clear type param:', error); | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| if (sessionType) { | |
| try { | |
| const url = new URL(window.location.href); | |
| url.searchParams.delete('type'); | |
| window.history.replaceState({}, '', url.toString()); | |
| } catch (error) { | |
| console.warn('Failed to clear type param:', error); | |
| } | |
| } |
dsehnal
approved these changes
Aug 14, 2025
dsehnal
left a comment
Member
There was a problem hiding this comment.
LGTM, feel free to merge when ready
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The goal of this change is to support the public share of sessions in addition to stories. Sessions shared with stories now get their public session URL that one can share + copy-paste into
https://molstar.org/mol-view-stories/builder.Solution
/storynow expects a "session" (mvstory) component/api/story/{id}/session-dataloadSessionFromUrlin addition toloadSession(from session id)Backward Compatibility
Testing
loadSessionFromUrlwon't work as hardcoded tohttps://molstar.org/mol-view-stories/builderunless we merge + deploy these changes:but:
http://localhost:3000/builder/?session-url=http%3A%2F%2Flocalhost%3A5000%2Fapi%2Fstory%2F95e233ca%2Fsession-dataworksActions
[Unreleased]section ofCHANGELOG.md