Skip to content

Conversation

@nsemets
Copy link
Collaborator

@nsemets nsemets commented Dec 3, 2025

  • Ticket: [ENG-9792]
  • Feature flag: n/a

Summary of Changes

  1. Added SSR.

@nsemets nsemets requested a review from brianjgeiger December 3, 2025 16:08
Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

Overall, looks good. I had a couple of questions on some removed code.

Is it feasible to add tests to ensure that the pages that we want to render server-side will be renderable server-side? I'd hate for us to add something that breaks the functionality without realizing it.

And my understanding is that this should have no effect on client-side rendering, it would only take effect when running a server instance and we push people to that server instance. Is that correct? So we'd be safe to merge this with a full regression test from QA to make sure we didn't accidentally break anything?

Comment on lines -22 to -46
const currentResource = store.selectSnapshot(CurrentResourceSelectors.getCurrentResource);
const currentUser = store.selectSnapshot(UserSelectors.getCurrentUser);

if (currentResource && !id.startsWith(currentResource.id)) {
if (currentResource.type === CurrentResourceType.Projects && currentResource.parentId) {
router.navigate(['/', currentResource.parentId, 'files', id], { queryParamsHandling: 'preserve' });
return true;
}

if (currentResource.type === CurrentResourceType.Preprints && currentResource.parentId) {
router.navigate(['/preprints', currentResource.parentId, id]);
return true;
}

if (currentResource.type === CurrentResourceType.Users) {
if (currentUser && currentUser.id === currentResource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

return currentResource.type === CurrentResourceType.Projects;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this not important? I didn't see a replacement for it anywhere, but maybe we're not really using it?

Comment on lines -22 to -46
const currentResource = store.selectSnapshot(CurrentResourceSelectors.getCurrentResource);
const currentUser = store.selectSnapshot(UserSelectors.getCurrentUser);

if (currentResource && !id.startsWith(currentResource.id)) {
if (currentResource.type === CurrentResourceType.Registrations && currentResource.parentId) {
router.navigate(['/', currentResource.parentId, 'files', id], { queryParamsHandling: 'preserve' });
return true;
}

if (currentResource.type === CurrentResourceType.Preprints && currentResource.parentId) {
router.navigate(['/preprints', currentResource.parentId, id]);
return true;
}

if (currentResource.type === CurrentResourceType.Users) {
if (currentUser && currentUser.id === currentResource.id) {
router.navigate(['/profile']);
} else {
router.navigate(['/user', id]);
}
return false;
}

return currentResource.type === CurrentResourceType.Registrations;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here.

@nsemets
Copy link
Collaborator Author

nsemets commented Dec 4, 2025

Is it feasible to add tests to ensure that the pages that we want to render server-side will be renderable server-side? I'd hate for us to add something that breaks the functionality without realizing it.

Yeah, I can add unit tests for pages with SSR. Issues can occur only during build time, initial loading, or hydration (when the browser receives the SSR HTML). After that, it will run using CSR.

@nsemets
Copy link
Collaborator Author

nsemets commented Dec 4, 2025

And my understanding is that this should have no effect on client-side rendering, it would only take effect when running a server instance and we push people to that server instance. Is that correct? So we'd be safe to merge this with a full regression test from QA to make sure we didn't accidentally break anything?

Yes, that's correct. It has no effect on client-side rendering. After the browser receives the SSR HTML and hydrates, all subsequent navigation is standard client-side SPA behavior, just like a non-SSR Angular app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants