Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanahuckova committed Jun 21, 2024
1 parent c97211c commit 85b48e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/editors/query/query.options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const BasicOptions = (props: {
{isInfinityQueryWithUrlSource(query) && (
<EditorRow label={'URL'}>
<Method query={query} onChange={onChange} onRunQuery={onRunQuery} />
<URL query={query as InfinityQueryWithURLSource<InfinityQueryType> } onChange={onChange} onRunQuery={onRunQuery} onShowUrlOptions={onShowUrlOptions} />
<URL query={query as InfinityQueryWithURLSource<InfinityQueryType>} onChange={onChange} onRunQuery={onRunQuery} onShowUrlOptions={onShowUrlOptions} />
<Button
variant="secondary"
fill="outline"
Expand Down
20 changes: 15 additions & 5 deletions src/editors/query/query.url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,24 @@ export const Method = ({ query, onChange, onRunQuery }: { query: InfinityQuery;
);
};

export const URL = ({ query, onChange, onRunQuery, onShowUrlOptions }: { query: InfinityQueryWithURLSource<InfinityQueryType>; onChange: (value: InfinityQueryWithURLSource<InfinityQueryType>) => void; onRunQuery: () => void; onShowUrlOptions: () => void }) => {
export const URL = ({
query,
onChange,
onRunQuery,
onShowUrlOptions,
}: {
query: InfinityQueryWithURLSource<InfinityQueryType>;
onChange: (value: InfinityQueryWithURLSource<InfinityQueryType>) => void;
onRunQuery: () => void;
onShowUrlOptions: () => void;
}) => {
const [url, setURL] = useState(query.url);
const previousUrl = usePrevious(query.url);

useEffect(() => {
if (query.url !== previousUrl && query.url !== url) {
setURL(query.url);
}
if (query.url !== previousUrl && query.url !== url) {
setURL(query.url);
}
}, [query.url, previousUrl, url]);

const onURLChange = () => {
Expand Down Expand Up @@ -288,4 +298,4 @@ const Body = ({ query, onChange, onRunQuery }: { query: InfinityQuery; onChange:
) : (
<></>
);
};
};

0 comments on commit 85b48e0

Please sign in to comment.