Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e1408b36
Commit
e1408b36
authored
Feb 01, 2022
by
Eduardo Sanz García
Committed by
Eduardo
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`useRootThread` Preact hook: convert to named export
parent
4157859d
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
18 additions
and
25 deletions
+18
-25
AnnotationView.js
src/sidebar/components/AnnotationView.js
+1
-1
FilterStatus.js
src/sidebar/components/FilterStatus.js
+1
-1
NotebookResultCount.js
src/sidebar/components/NotebookResultCount.js
+1
-1
NotebookView.js
src/sidebar/components/NotebookView.js
+1
-1
SidebarView.js
src/sidebar/components/SidebarView.js
+1
-1
StreamView.js
src/sidebar/components/StreamView.js
+1
-1
use-root-thread-test.js
src/sidebar/components/hooks/test/use-root-thread-test.js
+1
-1
use-root-thread.js
src/sidebar/components/hooks/use-root-thread.js
+1
-1
AnnotationView-test.js
src/sidebar/components/test/AnnotationView-test.js
+1
-2
FilterStatus-test.js
src/sidebar/components/test/FilterStatus-test.js
+2
-3
NotebookResultCount-test.js
src/sidebar/components/test/NotebookResultCount-test.js
+1
-1
NotebookView-test.js
src/sidebar/components/test/NotebookView-test.js
+1
-3
SidebarView-test.js
src/sidebar/components/test/SidebarView-test.js
+2
-4
StreamView-test.js
src/sidebar/components/test/StreamView-test.js
+1
-1
threading-test.js
src/sidebar/test/integration/threading-test.js
+2
-3
No files found.
src/sidebar/components/AnnotationView.js
View file @
e1408b36
...
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'preact/hooks';
...
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'preact/hooks';
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
withServices
}
from
'../service-context'
;
import
{
withServices
}
from
'../service-context'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
import
ThreadList
from
'./ThreadList'
;
import
ThreadList
from
'./ThreadList'
;
import
SidebarContentError
from
'./SidebarContentError'
;
import
SidebarContentError
from
'./SidebarContentError'
;
...
...
src/sidebar/components/FilterStatus.js
View file @
e1408b36
...
@@ -5,7 +5,7 @@ import { useMemo } from 'preact/hooks';
...
@@ -5,7 +5,7 @@ import { useMemo } from 'preact/hooks';
import
{
countVisible
}
from
'../helpers/thread'
;
import
{
countVisible
}
from
'../helpers/thread'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
/**
/**
* @typedef {import('../helpers/build-thread').Thread} Thread
* @typedef {import('../helpers/build-thread').Thread} Thread
...
...
src/sidebar/components/NotebookResultCount.js
View file @
e1408b36
import
{
Spinner
}
from
'@hypothesis/frontend-shared'
;
import
{
Spinner
}
from
'@hypothesis/frontend-shared'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
import
{
countVisible
}
from
'../helpers/thread'
;
import
{
countVisible
}
from
'../helpers/thread'
;
/**
/**
...
...
src/sidebar/components/NotebookView.js
View file @
e1408b36
...
@@ -9,7 +9,7 @@ import { useStoreProxy } from '../store/use-store';
...
@@ -9,7 +9,7 @@ import { useStoreProxy } from '../store/use-store';
import
NotebookFilters
from
'./NotebookFilters'
;
import
NotebookFilters
from
'./NotebookFilters'
;
import
NotebookResultCount
from
'./NotebookResultCount'
;
import
NotebookResultCount
from
'./NotebookResultCount'
;
import
PaginatedThreadList
from
'./PaginatedThreadList'
;
import
PaginatedThreadList
from
'./PaginatedThreadList'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
/**
/**
* @typedef NotebookViewProps
* @typedef NotebookViewProps
...
...
src/sidebar/components/SidebarView.js
View file @
e1408b36
import
{
useEffect
,
useRef
}
from
'preact/hooks'
;
import
{
useEffect
,
useRef
}
from
'preact/hooks'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
import
{
withServices
}
from
'../service-context'
;
import
{
withServices
}
from
'../service-context'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
tabForAnnotation
}
from
'../helpers/tabs'
;
import
{
tabForAnnotation
}
from
'../helpers/tabs'
;
...
...
src/sidebar/components/StreamView.js
View file @
e1408b36
...
@@ -2,7 +2,7 @@ import { useCallback, useEffect } from 'preact/hooks';
...
@@ -2,7 +2,7 @@ import { useCallback, useEffect } from 'preact/hooks';
import
*
as
searchFilter
from
'../util/search-filter'
;
import
*
as
searchFilter
from
'../util/search-filter'
;
import
{
withServices
}
from
'../service-context'
;
import
{
withServices
}
from
'../service-context'
;
import
useRootThread
from
'./hooks/use-root-thread'
;
import
{
useRootThread
}
from
'./hooks/use-root-thread'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
{
useStoreProxy
}
from
'../store/use-store'
;
import
ThreadList
from
'./ThreadList'
;
import
ThreadList
from
'./ThreadList'
;
...
...
src/sidebar/components/hooks/test/use-root-thread-test.js
View file @
e1408b36
import
{
mount
}
from
'enzyme'
;
import
{
mount
}
from
'enzyme'
;
import
useRootThread
,
{
$imports
}
from
'../use-root-thread'
;
import
{
useRootThread
,
$imports
}
from
'../use-root-thread'
;
describe
(
'sidebar/components/hooks/use-root-thread'
,
()
=>
{
describe
(
'sidebar/components/hooks/use-root-thread'
,
()
=>
{
let
fakeStore
;
let
fakeStore
;
...
...
src/sidebar/components/hooks/use-root-thread.js
View file @
e1408b36
...
@@ -11,7 +11,7 @@ import { threadAnnotations } from '../../helpers/thread-annotations';
...
@@ -11,7 +11,7 @@ import { threadAnnotations } from '../../helpers/thread-annotations';
*
*
* @return {Thread}
* @return {Thread}
*/
*/
export
default
function
useRootThread
()
{
export
function
useRootThread
()
{
const
store
=
useStoreProxy
();
const
store
=
useStoreProxy
();
const
annotations
=
store
.
allAnnotations
();
const
annotations
=
store
.
allAnnotations
();
const
query
=
store
.
filterQuery
();
const
query
=
store
.
filterQuery
();
...
...
src/sidebar/components/test/AnnotationView-test.js
View file @
e1408b36
...
@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
...
@@ -2,7 +2,6 @@ import { mount } from 'enzyme';
import
{
waitFor
}
from
'../../../test-util/wait'
;
import
{
waitFor
}
from
'../../../test-util/wait'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
AnnotationView
,
{
$imports
}
from
'../AnnotationView'
;
import
AnnotationView
,
{
$imports
}
from
'../AnnotationView'
;
describe
(
'AnnotationView'
,
()
=>
{
describe
(
'AnnotationView'
,
()
=>
{
...
@@ -32,7 +31,7 @@ describe('AnnotationView', () => {
...
@@ -32,7 +31,7 @@ describe('AnnotationView', () => {
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
});
});
});
});
...
...
src/sidebar/components/test/FilterStatus-test.js
View file @
e1408b36
import
{
mount
}
from
'enzyme'
;
import
{
mount
}
from
'enzyme'
;
import
FilterStatus
,
{
$imports
}
from
'../FilterStatus'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
FilterStatus
,
{
$imports
}
from
'../FilterStatus'
;
function
getFilterState
()
{
function
getFilterState
()
{
return
{
return
{
...
@@ -53,7 +52,7 @@ describe('FilterStatus', () => {
...
@@ -53,7 +52,7 @@ describe('FilterStatus', () => {
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../helpers/thread'
:
fakeThreadUtil
,
'../helpers/thread'
:
fakeThreadUtil
,
});
});
...
...
src/sidebar/components/test/NotebookResultCount-test.js
View file @
e1408b36
...
@@ -26,7 +26,7 @@ describe('NotebookResultCount', () => {
...
@@ -26,7 +26,7 @@ describe('NotebookResultCount', () => {
fakeUseRootThread
=
sinon
.
stub
().
returns
({
children
:
[]
});
fakeUseRootThread
=
sinon
.
stub
().
returns
({
children
:
[]
});
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../helpers/thread'
:
{
countVisible
:
fakeCountVisible
},
'../helpers/thread'
:
{
countVisible
:
fakeCountVisible
},
});
});
});
});
...
...
src/sidebar/components/test/NotebookView-test.js
View file @
e1408b36
...
@@ -2,9 +2,7 @@ import { mount } from 'enzyme';
...
@@ -2,9 +2,7 @@ import { mount } from 'enzyme';
import
{
act
}
from
'preact/test-utils'
;
import
{
act
}
from
'preact/test-utils'
;
import
{
checkAccessibility
}
from
'../../../test-util/accessibility'
;
import
{
checkAccessibility
}
from
'../../../test-util/accessibility'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
{
ResultSizeError
}
from
'../../search-client'
;
import
{
ResultSizeError
}
from
'../../search-client'
;
import
NotebookView
,
{
$imports
}
from
'../NotebookView'
;
import
NotebookView
,
{
$imports
}
from
'../NotebookView'
;
...
@@ -44,7 +42,7 @@ describe('NotebookView', () => {
...
@@ -44,7 +42,7 @@ describe('NotebookView', () => {
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'scroll-into-view'
:
fakeScrollIntoView
,
'scroll-into-view'
:
fakeScrollIntoView
,
});
});
...
...
src/sidebar/components/test/SidebarView-test.js
View file @
e1408b36
import
{
mount
}
from
'enzyme'
;
import
{
mount
}
from
'enzyme'
;
import
SidebarView
from
'../SidebarView'
;
import
{
$imports
}
from
'../SidebarView'
;
import
{
checkAccessibility
}
from
'../../../test-util/accessibility'
;
import
{
checkAccessibility
}
from
'../../../test-util/accessibility'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
{
mockImportedComponents
}
from
'../../../test-util/mock-imported-components'
;
import
SidebarView
,
{
$imports
}
from
'../SidebarView'
;
describe
(
'SidebarView'
,
()
=>
{
describe
(
'SidebarView'
,
()
=>
{
let
fakeFrameSync
;
let
fakeFrameSync
;
...
@@ -70,7 +68,7 @@ describe('SidebarView', () => {
...
@@ -70,7 +68,7 @@ describe('SidebarView', () => {
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../helpers/tabs'
:
fakeTabsUtil
,
'../helpers/tabs'
:
fakeTabsUtil
,
});
});
...
...
src/sidebar/components/test/StreamView-test.js
View file @
e1408b36
...
@@ -40,7 +40,7 @@ describe('StreamView', () => {
...
@@ -40,7 +40,7 @@ describe('StreamView', () => {
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
$imports
.
$mock
({
'./hooks/use-root-thread'
:
fakeUseRootThread
,
'./hooks/use-root-thread'
:
{
useRootThread
:
fakeUseRootThread
}
,
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../store/use-store'
:
{
useStoreProxy
:
()
=>
fakeStore
},
'../util/search-filter'
:
fakeSearchFilter
,
'../util/search-filter'
:
fakeSearchFilter
,
});
});
...
...
src/sidebar/test/integration/threading-test.js
View file @
e1408b36
...
@@ -3,10 +3,9 @@ import { useReducer } from 'preact/hooks';
...
@@ -3,10 +3,9 @@ import { useReducer } from 'preact/hooks';
import
{
act
}
from
'preact/test-utils'
;
import
{
act
}
from
'preact/test-utils'
;
import
{
Injector
}
from
'../../../shared/injector'
;
import
{
Injector
}
from
'../../../shared/injector'
;
import
{
createSidebarStore
}
from
'../../store'
;
import
{
useRootThread
}
from
'../../components/hooks/use-root-thread'
;
import
{
ServiceContext
}
from
'../../service-context'
;
import
{
ServiceContext
}
from
'../../service-context'
;
import
useRootThread
from
'../../components/hooks/use-root-thread
'
;
import
{
createSidebarStore
}
from
'../../store
'
;
const
fixtures
=
{
const
fixtures
=
{
annotations
:
[
annotations
:
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment