Skip to content

Commit

Permalink
Fixed search state
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoAbove committed Aug 13, 2024
1 parent a23d587 commit 122e25d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 6 additions & 8 deletions src/components/SearchSeeds/SearchContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ const SearchContextProvider: FC<{ children: React.ReactNode }> = ({ children })
loadQuery();
}, [currentSearchUUID]);

const updateSearchConfig = useCallback(
(config: Partial<SearchesItem["config"]>) => {
if (searchInstance) {
db.searches.update(searchInstance.id!, { config: { ...searchInstance.config, ...config } });
}
},
[searchInstance],
);
const updateSearchConfig = (config: Partial<SearchesItem["config"]>) => {
if (searchInstance) {
db.searches.update(searchInstance.id!, { config: { ...searchInstance.config, ...config } });
setQuery({ ...searchInstance, config: { ...searchInstance.config, ...config } });
}
};

useEffect(() => {
if (!searchInstance) return;
Expand Down
3 changes: 1 addition & 2 deletions src/components/SearchSeeds/SearchViews/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const Search = () => {
startCalculation,
stopCalculation,
computeJobName,
handleComputeJobNameChange,
handleSeedEndChange,
handleCustomSeedListChange,
updateSearchConfig,
Expand Down Expand Up @@ -110,7 +109,7 @@ const Search = () => {
id="SearchSeeds.name"
disabled={running || !solverReady}
value={computeJobName}
onChange={e => handleComputeJobNameChange(e.target.value)}
onChange={e => updateSearchConfig({ name: e.target.value })}
/>
</Form.Group>
</Col>
Expand Down

0 comments on commit 122e25d

Please sign in to comment.