Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load product on page lang change and router param update #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IshavSohal
Copy link
Member

@IshavSohal IshavSohal commented Feb 20, 2025

Related Item(s)

#552

Changes

  • Within editor-metadata, product gets loaded in again upon a page lang change, by passing the product's uuid in the router link
    • Also set uid as a temporary prop for the metadataExisting route
  • When updating router param from editor-main to editor-metadata (as well as changing page lang), the product gets loaded successfully, by preventing an unlock message from being sent to the web socket

Notes

  • I noticed that, when updating the router params to access a product, the message to unlock the product gets sent (almost) at the same time as the message to lock the product
  • Due to this, the handleMessage event handler is only able to process one of them, and since the unlock message is sent slightly before the lock message, that is the one that gets processed
  • This message handling causes the secret to be removed from the lock store, and thus prevents the product from loading in
  • Since a call to unlockStorylines() already takes place upon updating router params, I decided to comment out this line to prevent a message from being sent to the web socket upon product unlock. This doesn't seem to cause any issues based on my testing, but lmk if this could be problematic

Testing

Will need to update server locally to test this

Steps:

  1. Comment out this line in your local server
  2. Load any product
  3. Switch the page lang using the lang toggle
  4. Observe that the product loads in again
  5. Switch the page lang in the router params
  6. Observe that the product loads in again
  7. Click next to move to editor-main
  8. Go back to editor-metadata by updating the router params
  9. Observe that the product load in again

This change is Reviewable

@IshavSohal IshavSohal added the PR: Active PRs that require a fierce eyeballin. label Feb 20, 2025
Copy link

Your demo site is ready! 🚀 Visit it here: https://ramp4-pcar4.github.io/storylines-editor/issue-552

Copy link
Member

@yileifeng yileifeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @IshavSohal)


src/router/index.ts line 49 at r1 (raw file):

    },
    {
        path: '/:lang/editor-metadata/:uid',

Are we able to remove this route now since the uid is added as an optional parameter above?

Copy link
Member Author

@IshavSohal IshavSohal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @yileifeng)


src/router/index.ts line 49 at r1 (raw file):

Previously, yileifeng (Yi Lei Feng) wrote…

Are we able to remove this route now since the uid is added as an optional parameter above?

Good catch, donethanks

Copy link
Member

@yileifeng yileifeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @IshavSohal)

Copy link
Member

@szczz szczz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary blocker as the socket server implementation may change.

Reviewed 3 of 4 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @IshavSohal)

Copy link
Member

@szczz szczz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Socket server changes finalized for now. Please rebase with main

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @IshavSohal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Active PRs that require a fierce eyeballin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants