apps 0.0.1-beta.48 → 0.0.1-beta.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js/client.js CHANGED
@@ -476,6 +476,8 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
476
476
  const onError = (event) => error("ui.error", event.error ?? new Error(event.message));
477
477
  const onRejection = (event) => error("ui.unhandled-rejection", event.reason);
478
478
  const onHidden = () => {
479
+ if (navigation !== void 0 && document.visibilityState === "hidden")
480
+ navigation.hidden = true;
479
481
  run(
480
482
  document.visibilityState === "hidden" ? performance.pause.pipe(Effect_exports.andThen(flush)) : performance.resume
481
483
  );
@@ -503,15 +505,27 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
503
505
  return {
504
506
  flush,
505
507
  navigation: (event) => Effect_exports.sync(() => {
508
+ if (event.type === "load") return;
506
509
  if (event.type === "end") {
507
- if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation, Effect_exports.void);
510
+ if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation.done, Effect_exports.void);
508
511
  navigation = void 0;
509
512
  return;
510
513
  }
511
- if (navigation !== void 0) Deferred_exports.doneUnsafe(navigation, Effect_exports.interrupt);
512
- navigation = Deferred_exports.makeUnsafe();
514
+ if (navigation !== void 0)
515
+ Deferred_exports.doneUnsafe(navigation.done, Effect_exports.interrupt);
516
+ const current = {
517
+ done: Deferred_exports.makeUnsafe(),
518
+ hidden: document.visibilityState === "hidden"
519
+ };
520
+ navigation = current;
513
521
  run(
514
- Deferred_exports.await(navigation).pipe(
522
+ Deferred_exports.await(current.done).pipe(
523
+ // Record visibility however the navigation ends, including when a later one interrupts it.
524
+ Effect_exports.ensuring(
525
+ Effect_exports.suspend(
526
+ () => Effect_exports.annotateCurrentSpan("executor.navigation.hidden", current.hidden)
527
+ )
528
+ ),
515
529
  Effect_exports.withSpan("ui.navigation", {
516
530
  root: true,
517
531
  attributes: { "url.path": event.path }
@@ -521,7 +535,7 @@ var browserTelemetryLayer = (settings) => Layer_exports.unwrap(
521
535
  );
522
536
  }).pipe(
523
537
  Effect_exports.andThen(
524
- event.type === "start" ? performance.navigation(event.path) : Effect_exports.void
538
+ event.type === "end" ? Effect_exports.void : performance.navigation(event.path)
525
539
  )
526
540
  )
527
541
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.48",
3
+ "version": "0.0.1-beta.54",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,