Skip to content

Commit

Permalink
Starting to update the global context that handles the search logic t…
Browse files Browse the repository at this point in the history
…o use an immutable filter instead of just rehydrating the search (#18)
  • Loading branch information
zachsa committed Nov 17, 2022
1 parent 4eee7c3 commit 37550d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions clients/src/contexts/global/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createContext } from 'react'
import QuickForm from '../../packages/quick-form'
import getUriState from '../../lib/fns/get-uri-state'
import FromSavedSearch from './from-saved-search'
import List from './list'

export const context = createContext()

Expand All @@ -26,16 +26,17 @@ export default ({ children }) => {
const { search, text = undefined, referrer = undefined } = getUriState()

return (
<FromSavedSearch id={search}>
{search => (
<List id={search}>
{filter => (
<QuickForm
referrer={referrer}
text={text || search?.text || ''}
extent={search?.extent || undefined}
terms={search?.terms || []}
ids={search?.ids || []}
dois={search?.dois || []}
selectedIds={search?.selectedIds || []}
filter={filter?.filter || {}}
text={text || filter?.text || ''}
extent={filter?.extent || undefined}
terms={filter?.terms || []}
ids={filter?.ids || []}
dois={filter?.dois || []}
selectedIds={filter?.selectedIds || []}
>
{(setGlobal, global) => {
return (
Expand Down Expand Up @@ -66,6 +67,6 @@ export default ({ children }) => {
}}
</QuickForm>
)}
</FromSavedSearch>
</List>
)
}
File renamed without changes.

0 comments on commit 37550d7

Please sign in to comment.