Skip to content

[Angular CSDK] ISR-like loader cache implementation#491

Merged
art-alexeyenko merged 16 commits into
feature/angular-csdkfrom
feature/jss-9590-angular-isr
Jun 3, 2026
Merged

[Angular CSDK] ISR-like loader cache implementation#491
art-alexeyenko merged 16 commits into
feature/angular-csdkfrom
feature/jss-9590-angular-isr

Conversation

@art-alexeyenko
Copy link
Copy Markdown
Collaborator

@art-alexeyenko art-alexeyenko commented May 27, 2026

Introduces a caching layer for loaders in Angular CSDK. It's designed to provide ISR-like behavior: cache entries for loaders are created and reused until becoming stale. When stale loader cache is accessed, it is revalidated (stale-while-revalidate, similar to next).
This is not a full fledged ISR implementation, however, and it's goal is to minimize Edge calls. Similarly, this does not introduce SSG support (it will be it's own can of worms later, but we have building blocks).

  • adds ISR-like cache implementation
  • cache contains loaders data (page, dictionary)
  • support for OSR tag-based revalidation (following conventions from recent nextjs implementation)
  • Temp Cache admin demo page for testing
  • revalidation follows stale-while-revalidate principles
    • this includes changes to base loader resolver logic
    • two distinct loader flows: browser, server
    • cache only exists on server (we also ensure loaders themselves are only executed on server)
    • when cache entry ttl is reached or revalidate request received, cache entry is stale instead of removed (performance ++)
  • tags support
    • there are two main cache implementations - default in-memory (similar to rjx-angular/isr) and unstorage
    • default one has a map of cache entries (with cache keys) and a collection of tag -> [cache keys] entries. This is how we find cache key by tag.
    • unstorage accepts a driver during implementation (memory, fs, redis etc) and uses it to invoke a storage. unstorage storage stores tags, cache keys and cache values in a similar way.
  • cache is invoked in app, src/server.ts and cache object pointer is passed down into Angular SSR to ensure consistency.

(cherry picked from commit 45640df4faa70b53b73d0a8ac9c25a8ba7344d51)
(cherry picked from commit d3f5b4c33c683018882f0c0289551f7b7787a746)
…ntent-sdk into feature/jss-9590-angular-isr

# Conflicts:
#	packages/angular/ng-package.json
#	packages/angular/src/loaders/loader-resolver.ts
#	packages/create-content-sdk-app/src/templates/angular/src/app/app.config.ts
#	packages/create-content-sdk-app/src/templates/angular/src/app/app.routes.ts
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

⚠️ No Changeset found

Latest commit: f1b5f30

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@art-alexeyenko art-alexeyenko marked this pull request as ready for review May 28, 2026 20:22
Comment thread packages/angular/src/server/server-loader-runner.ts Outdated
Comment thread packages/angular/src/server/models.ts Outdated
Comment thread packages/angular/src/server/middleware/sitecore-revalidate-middleware.ts Outdated
Comment thread packages/angular/src/server/middleware/sitecore-revalidate-middleware.ts Outdated
Comment thread packages/angular/src/server/middleware/sitecore-edge-webhook-revalidation.ts Outdated
Comment thread packages/angular/src/server/cache/utils.ts Outdated
Comment thread packages/angular/src/server/cache/utils.ts Outdated
Comment thread packages/angular/src/server/cache/unstorage-loader-cache.ts
Comment thread packages/angular/src/server/cache/unstorage-loader-cache.ts Outdated
Comment thread packages/angular/src/server/cache/loader-cache.ts Outdated
Comment thread packages/angular/src/config/define-config.ts Outdated
Copy link
Copy Markdown
Contributor

@sc-nikolaoslazaridis sc-nikolaoslazaridis left a comment

Choose a reason for hiding this comment

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

Good job!

@art-alexeyenko art-alexeyenko merged commit 0eca00d into feature/angular-csdk Jun 3, 2026
@art-alexeyenko art-alexeyenko deleted the feature/jss-9590-angular-isr branch June 3, 2026 12:23
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