@foxglove/embed-react 0.76.0 → 0.78.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"useShouldNotChangeOften.d.ts","sourceRoot":"","sources":["../src/useShouldNotChangeOften.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,CAAC,CAkBxE"}
1
+ {"version":3,"file":"useShouldNotChangeOften.d.ts","sourceRoot":"","sources":["../src/useShouldNotChangeOften.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,CAAC,CAqBxE"}
@@ -1,7 +1,7 @@
1
- // This file is copied from @foxglove/viz/hooks/useShouldNotChangeOften.ts
2
- // We copy the file to avoid depending on the viz package.
1
+ // This file is copied from @foxglove/app/src/viz/hooks/useShouldNotChangeOften.ts
2
+ // We copy the file to avoid depending on the app package.
3
3
  //
4
- // The viz copy additionally compiles itself out of production builds. This one does not: it is
4
+ // That copy additionally compiles itself out of production builds. This one does not: it is
5
5
  // called twice in one component rather than once per layout selector, and this package ships
6
6
  // unbundled, with no `process` binding to test and no bundler to fold the branch away.
7
7
  import { useLayoutEffect, useRef } from "react";
@@ -13,6 +13,9 @@ import { useLayoutEffect, useRef } from "react";
13
13
  export function useShouldNotChangeOften(value, warn) {
14
14
  const prev = useRef(value);
15
15
  const prevPrev = useRef(value);
16
+ // `useRef` evaluates the clock read during render but only uses the initial value.
17
+ // Each rate comparison uses a post-commit timestamp captured in the layout effect.
18
+ // eslint-disable-next-line react-hooks/purity
16
19
  const lastTime = useRef(Date.now());
17
20
  useLayoutEffect(() => {
18
21
  const now = Date.now();
@@ -1 +1 @@
1
- {"version":3,"file":"useShouldNotChangeOften.js","sourceRoot":"","sources":["../src/useShouldNotChangeOften.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,0DAA0D;AAC1D,EAAE;AACF,+FAA+F;AAC/F,6FAA6F;AAC7F,uFAAuF;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAI,KAAQ,EAAE,IAAgB;IACnE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,MAAM,CAAS,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IACE,KAAK,KAAK,IAAI,CAAC,OAAO;YACtB,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;YACjC,GAAG,GAAG,QAAQ,CAAC,OAAO,GAAG,GAAG,EAC5B,CAAC;YACD,IAAI,EAAE,CAAC;QACT,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"useShouldNotChangeOften.js","sourceRoot":"","sources":["../src/useShouldNotChangeOften.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,0DAA0D;AAC1D,EAAE;AACF,4FAA4F;AAC5F,6FAA6F;AAC7F,uFAAuF;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAI,KAAQ,EAAE,IAAgB;IACnE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,mFAAmF;IACnF,mFAAmF;IACnF,8CAA8C;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAS,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IACE,KAAK,KAAK,IAAI,CAAC,OAAO;YACtB,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,OAAO;YACjC,GAAG,GAAG,QAAQ,CAAC,OAAO,GAAG,GAAG,EAC5B,CAAC;YACD,IAAI,EAAE,CAAC;QACT,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/embed-react",
3
- "version": "0.76.0",
3
+ "version": "0.78.0",
4
4
  "keywords": [
5
5
  "foxglove",
6
6
  "react",
@@ -31,7 +31,7 @@
31
31
  "prepack": "yarn build"
32
32
  },
33
33
  "dependencies": {
34
- "@foxglove/embed": "0.76.0"
34
+ "@foxglove/embed": "0.78.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/react": "19.2.18",
@@ -1,7 +1,7 @@
1
- // This file is copied from @foxglove/viz/hooks/useShouldNotChangeOften.ts
2
- // We copy the file to avoid depending on the viz package.
1
+ // This file is copied from @foxglove/app/src/viz/hooks/useShouldNotChangeOften.ts
2
+ // We copy the file to avoid depending on the app package.
3
3
  //
4
- // The viz copy additionally compiles itself out of production builds. This one does not: it is
4
+ // That copy additionally compiles itself out of production builds. This one does not: it is
5
5
  // called twice in one component rather than once per layout selector, and this package ships
6
6
  // unbundled, with no `process` binding to test and no bundler to fold the branch away.
7
7
 
@@ -15,6 +15,9 @@ import { useLayoutEffect, useRef } from "react";
15
15
  export function useShouldNotChangeOften<T>(value: T, warn: () => void): T {
16
16
  const prev = useRef(value);
17
17
  const prevPrev = useRef(value);
18
+ // `useRef` evaluates the clock read during render but only uses the initial value.
19
+ // Each rate comparison uses a post-commit timestamp captured in the layout effect.
20
+ // eslint-disable-next-line react-hooks/purity
18
21
  const lastTime = useRef<number>(Date.now());
19
22
  useLayoutEffect(() => {
20
23
  const now = Date.now();