Skip to content

Commit

Permalink
Replace local useStableCallback hook with version from @hypothesis/…
Browse files Browse the repository at this point in the history
…frontend-shared

This hook was copied from Via into the frontend-shared package in
hypothesis/frontend-shared#1357.
  • Loading branch information
robertknight committed Nov 10, 2023
1 parent 2f78ad1 commit 3a93e7a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 71 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@hypothesis/frontend-build": "^3.0.0",
"@hypothesis/frontend-shared": "^6.10.0",
"@hypothesis/frontend-shared": "^6.11.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
Expand Down
2 changes: 1 addition & 1 deletion via/static/scripts/video_player/components/Transcript.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Scroll, ScrollContainer } from '@hypothesis/frontend-shared';
import { useStableCallback } from '@hypothesis/frontend-shared/lib/hooks/use-stable-callback';
import classnames from 'classnames';
import type { ComponentChildren, Ref } from 'preact';
import {
Expand All @@ -10,7 +11,6 @@ import {
} from 'preact/hooks';

import { useScrollAnchor } from '../hooks/use-scroll-anchor';
import { useStableCallback } from '../hooks/use-stable-callback';
import { TextHighlighter } from '../utils/highlighter';
import { formatTimestamp } from '../utils/time';
import type { MatchOffset, Segment, TranscriptData } from '../utils/transcript';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Spinner,
ToastMessages,
} from '@hypothesis/frontend-shared';
import { useStableCallback } from '@hypothesis/frontend-shared/lib/hooks/use-stable-callback';
import classnames from 'classnames';
import {
useCallback,
Expand All @@ -17,7 +18,6 @@ import {

import { useAppLayout } from '../hooks/use-app-layout';
import { useSideBySideLayout } from '../hooks/use-side-by-side-layout';
import { useStableCallback } from '../hooks/use-stable-callback';
import { useToastMessages } from '../hooks/use-toast-messages';
import { callAPI } from '../utils/api';
import type { APIMethod, APIError, JSONAPIObject } from '../utils/api';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AspectRatio } from '@hypothesis/frontend-shared';
import { useStableCallback } from '@hypothesis/frontend-shared/lib/hooks/use-stable-callback';
import { useEffect, useMemo, useRef, useState } from 'preact/hooks';

import { useStableCallback } from '../hooks/use-stable-callback';
import { loadYouTubeIFrameAPI } from '../utils/youtube';

/**
Expand Down

This file was deleted.

23 changes: 0 additions & 23 deletions via/static/scripts/video_player/hooks/use-stable-callback.ts

This file was deleted.

10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2048,15 +2048,15 @@ __metadata:
languageName: node
linkType: hard

"@hypothesis/frontend-shared@npm:^6.10.0":
version: 6.10.0
resolution: "@hypothesis/frontend-shared@npm:6.10.0"
"@hypothesis/frontend-shared@npm:^6.11.0":
version: 6.11.0
resolution: "@hypothesis/frontend-shared@npm:6.11.0"
dependencies:
highlight.js: ^11.6.0
wouter-preact: ^2.10.0-alpha.1
peerDependencies:
preact: ^10.4.0
checksum: bf58240a46270ab6674e2c1bbd2ea5994ac6112b9bb531ae69bc3dbb7418e335a62577bf99660369264fff9ae1813f47d27cb9ecd6764a7fe1cd471ee9bb825d
checksum: 5231f1617ae90dd484b3fd838df98892574233c329d45753213e1043188f2beaa92e742df809829d1be97f579d7788f6b6cf4344703ec8c05fb669ba735a480c
languageName: node
linkType: hard

Expand Down Expand Up @@ -10768,7 +10768,7 @@ __metadata:
"@babel/preset-react": ^7.22.15
"@babel/preset-typescript": ^7.23.2
"@hypothesis/frontend-build": ^3.0.0
"@hypothesis/frontend-shared": ^6.10.0
"@hypothesis/frontend-shared": ^6.11.0
"@hypothesis/frontend-testing": ^1.0.1
"@rollup/plugin-babel": ^6.0.4
"@rollup/plugin-commonjs": ^25.0.7
Expand Down

0 comments on commit 3a93e7a

Please sign in to comment.