Skip to content

Commit

Permalink
Mocks the server property inside the already mocked session to avoid …
Browse files Browse the repository at this point in the history
…errors with publication strategies
  • Loading branch information
filipenevola committed Sep 30, 2021
1 parent d9b622d commit 8af02a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Fast Render can improve the initial load time of your app, giving you 2-10 times
- [Client Error: "Server sent add for existing id"](#client-error-server-sent-add-for-existing-id)
- [No data is injected when using "AppCache" package](#no-data-is-injected-when-using-appcache-package)
- [No data is injected when using Meteor Subscription Cache](#no-data-is-injected-when-using-meteor-subscription-cache)
- [No support for publication strategies](#no-support-for-publication-strategies)
- [Debugging](#debugging)
- [Block DDP](#block-ddp)
- [Get Payload](#get-payload)
Expand Down Expand Up @@ -205,6 +206,10 @@ Related Issue & Discussion: <https://github.com/kadirahq/fast-render/issues/136>

When using the subscache package (`ccorcos:subs-cache` or `blockrazor:subscache-c4`) the parameters passed to the subscription must the identical on both Fast Render and Subscache or no data will be injected.

### No support for publication strategies

This package could affect the behavior of non-default [publication strategies](https://docs.meteor.com/api/pubsub.html#Publication-strategies).

## Debugging

Sometimes, you need to test whether Fast Render is working or not. You can do this using the built-in debugger. The debugger works on the client and is safe to run it on a deployed app. It has a few useful features:
Expand Down
10 changes: 10 additions & 0 deletions lib/server/publish_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ const PublishContext = function PublishContext (
params,
name,
) {
// mock server
const server = {
getPublicationStrategy() {
return {
useCollectionView: true,
doAccountingForCollection: true,
}
}
}
// mock session
const sessionId = Random.id();
const session = {
server,
id: sessionId,
userId: context.userId,
// not null
Expand Down

0 comments on commit 8af02a1

Please sign in to comment.