Skip to content

Commit

Permalink
Load product on page lang change and router param update
Browse files Browse the repository at this point in the history
  • Loading branch information
IshavSohal committed Mar 6, 2025
1 parent 7a87131 commit 8e0b07d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 6 additions & 1 deletion server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,9 @@ wss.on('connection', (ws) => {
const secret = generateKey();
lockedUuids[uuid] = secret;
ws.uuid = uuid;
// This msg is not being received by lockStore upon loading product via router params (in particular
// from editor-main to editor-metadata). However the below msg is received (upon unlocking). Both
// messages sent at exact same time.
ws.send(JSON.stringify({ status: 'success', secret }));

broadcastToClients({
Expand All @@ -660,7 +663,9 @@ wss.on('connection', (ws) => {
logger('INFO', `A client successfully unlocked the storyline ${uuid}.`);
delete lockedUuids[uuid];
delete ws.uuid;
ws.send(JSON.stringify({ status: 'success' }));
// Gets sent at same time as above msg upon loading product via router params. Do we need this?
// A call to unlock the product already occurs upon switching pages
// ws.send(JSON.stringify({ status: 'success' }));

broadcastToClients({
type: 'unlock',
Expand Down
3 changes: 1 addition & 2 deletions src/components/metadata-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
v-if="!currentRoute.includes('index-ca')"
:to="{
name: editExisting ? 'metadataExisting' : 'metadataNew',
params: { lang: currLang === 'en' ? 'fr' : 'en' }
params: { lang: currLang === 'en' ? 'fr' : 'en', uid: uuid }
}"
class="sub-link"
>
Expand Down Expand Up @@ -746,7 +746,6 @@ export default class MetadataEditorV extends Vue {
created(): void {
this.loadExisting = this.editExisting;
// Generate UUID for new product
this.uuid = (this.$route.params.uid as string) ?? (this.loadExisting ? undefined : uuidv4());
this.configLang = (this.$route.params.lang as string) || 'en';
Expand Down
7 changes: 1 addition & 6 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const routes = [
}
},
{
path: '/:lang/editor-metadata',
path: '/:lang/editor-metadata/:uid?',
name: 'metadataExisting',
component: MetadataEditorV,
props: { editExisting: true },
Expand All @@ -45,11 +45,6 @@ const routes = [
props: { editExisting: false },
meta: { title: 'editor.window.title' }
},
{
path: '/:lang/editor-metadata/:uid',
component: MetadataEditorV,
meta: { title: 'editor.window.title' }
},
{
path: '/:lang/editor-main/:uid',
name: 'editor',
Expand Down

0 comments on commit 8e0b07d

Please sign in to comment.