Skip to content

Commit b47c945

Browse files
Merge pull request #329 from edisontim/fix/historical-false-default
fix: change historical to false for events
2 parents 75be133 + d4437d2 commit b47c945

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/state/src/recs/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const getSyncEntities = async <S extends Schema>(
6363
* @param entityKeyClause - An array of entity key clauses to synchronize.
6464
* @param limit - The maximum number of events to fetch per request (default: 100).
6565
* @param logging - Whether to log debug information (default: false).
66-
* @param historical - Whether to fetch and subscribe to historical events (default: true).
66+
* @param historical - Whether to fetch and subscribe to historical events (default: false).
6767
* @returns A promise that resolves to a subscription for event updates.
6868
*
6969
* @example
@@ -158,15 +158,15 @@ export const getEntities = async <S extends Schema>(
158158
* @param limit - The maximum number of event messages to fetch per request (default: 100).
159159
* @param clause - An optional clause to filter event messages.
160160
* @param logging - Whether to log debug information (default: false).
161-
* @param historical - Whether to fetch historical events (default: true).
161+
* @param historical - Whether to fetch historical events (default: false).
162162
*/
163163
export const getEvents = async <S extends Schema>(
164164
client: ToriiClient,
165165
components: Component<S, Metadata, undefined>[],
166166
limit: number = 100,
167167
clause: Clause | undefined,
168168
logging: boolean = false,
169-
historical: boolean = true
169+
historical: boolean = false
170170
) => {
171171
if (logging) console.log("Starting getEvents");
172172
let offset = 0;
@@ -187,7 +187,7 @@ export const getEvents = async <S extends Schema>(
187187

188188
setEntities(entities, components, logging);
189189

190-
if (Object.keys(entities).length < limit) {
190+
if (Object.keys(entities).length === 0) {
191191
continueFetching = false;
192192
} else {
193193
offset += limit;
@@ -301,7 +301,7 @@ export const syncEntities = async <S extends Schema>(
301301
* @param components - An array of component definitions.
302302
* @param entityKeyClause - An array of EntityKeysClause to filter entities.
303303
* @param logging - Whether to log debug information (default: false).
304-
* @param historical - Whether to sync to historical events (default: true).
304+
* @param historical - Whether to sync to historical events (default: false).
305305
* @returns A promise that resolves with the subscription handler.
306306
* @example
307307
* const sync = await syncEvents(client, components, entityKeyClause);
@@ -313,7 +313,7 @@ export const syncEvents = async <S extends Schema>(
313313
components: Component<S, Metadata, undefined>[],
314314
entityKeyClause: EntityKeysClause[],
315315
logging: boolean = false,
316-
historical: boolean = true
316+
historical: boolean = false
317317
) => {
318318
if (logging) console.log("Starting syncEvents");
319319
return await client.onEventMessageUpdated(

0 commit comments

Comments
 (0)