Skip to content

Commit

Permalink
Merge pull request #5 from filipenevola/mock-server-for-publication-s…
Browse files Browse the repository at this point in the history
…trategies

Mocks the server property inside the already mocked session
  • Loading branch information
copleykj authored Sep 30, 2021
2 parents d9b622d + d32314c commit 17b731e
Show file tree
Hide file tree
Showing 2 changed files with 16 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
11 changes: 11 additions & 0 deletions lib/server/publish_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import { EJSON } from 'meteor/ejson';
import { Meteor } from 'meteor/meteor';
import { MeteorX } from 'meteor/montiapm:meteorx';

// mock server
const server = {
getPublicationStrategy () {
return {
useCollectionView: true,
doAccountingForCollection: true,
};
},
};

const PublishContext = function PublishContext (
context,
handler,
Expand All @@ -14,6 +24,7 @@ const PublishContext = function PublishContext (
// mock session
const sessionId = Random.id();
const session = {
server,
id: sessionId,
userId: context.userId,
// not null
Expand Down

0 comments on commit 17b731e

Please sign in to comment.