Skip to content

Commit

Permalink
fix: change historical to false for events
Browse files Browse the repository at this point in the history
  • Loading branch information
edisontim committed Nov 11, 2024
1 parent 75be133 commit d4437d2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/state/src/recs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const getSyncEntities = async <S extends Schema>(
* @param entityKeyClause - An array of entity key clauses to synchronize.
* @param limit - The maximum number of events to fetch per request (default: 100).
* @param logging - Whether to log debug information (default: false).
* @param historical - Whether to fetch and subscribe to historical events (default: true).
* @param historical - Whether to fetch and subscribe to historical events (default: false).
* @returns A promise that resolves to a subscription for event updates.
*
* @example
Expand Down Expand Up @@ -158,15 +158,15 @@ export const getEntities = async <S extends Schema>(
* @param limit - The maximum number of event messages to fetch per request (default: 100).
* @param clause - An optional clause to filter event messages.
* @param logging - Whether to log debug information (default: false).
* @param historical - Whether to fetch historical events (default: true).
* @param historical - Whether to fetch historical events (default: false).
*/
export const getEvents = async <S extends Schema>(
client: ToriiClient,
components: Component<S, Metadata, undefined>[],
limit: number = 100,
clause: Clause | undefined,
logging: boolean = false,
historical: boolean = true
historical: boolean = false
) => {
if (logging) console.log("Starting getEvents");
let offset = 0;
Expand All @@ -187,7 +187,7 @@ export const getEvents = async <S extends Schema>(

setEntities(entities, components, logging);

if (Object.keys(entities).length < limit) {
if (Object.keys(entities).length === 0) {
continueFetching = false;
} else {
offset += limit;
Expand Down Expand Up @@ -301,7 +301,7 @@ export const syncEntities = async <S extends Schema>(
* @param components - An array of component definitions.
* @param entityKeyClause - An array of EntityKeysClause to filter entities.
* @param logging - Whether to log debug information (default: false).
* @param historical - Whether to sync to historical events (default: true).
* @param historical - Whether to sync to historical events (default: false).
* @returns A promise that resolves with the subscription handler.
* @example
* const sync = await syncEvents(client, components, entityKeyClause);
Expand All @@ -313,7 +313,7 @@ export const syncEvents = async <S extends Schema>(
components: Component<S, Metadata, undefined>[],
entityKeyClause: EntityKeysClause[],
logging: boolean = false,
historical: boolean = true
historical: boolean = false
) => {
if (logging) console.log("Starting syncEvents");
return await client.onEventMessageUpdated(
Expand Down

0 comments on commit d4437d2

Please sign in to comment.