forked from voxel51/fiftyone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request voxel51#3771 from voxel51/merge-main
Merge main to develop
- Loading branch information
Showing
54 changed files
with
684 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ on: | |
pull_request: | ||
branches: | ||
- develop | ||
- main | ||
- rel-* | ||
- release-* | ||
- release/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useEffect, useRef, useState } from "react"; | ||
import { useRecoilValue, useSetRecoilState } from "recoil"; | ||
import { isEqual } from "lodash"; | ||
import { | ||
ExecutionContext, | ||
fetchRemotePlacements, | ||
resolveLocalPlacements, | ||
} from "./operators"; | ||
import { operatorPlacementsAtom, operatorThrottledContext } from "./state"; | ||
|
||
export function useOperatorPlacementsResolver() { | ||
const context = useRecoilValue(operatorThrottledContext); | ||
const setOperatorPlacementsAtom = useSetRecoilState(operatorPlacementsAtom); | ||
const [resolving, setResolving] = useState(false); | ||
const lastContext = useRef(null); | ||
|
||
useEffect(() => { | ||
async function updateOperatorPlacementsAtom() { | ||
setResolving(true); | ||
try { | ||
const ctx = new ExecutionContext({}, context); | ||
const remotePlacements = await fetchRemotePlacements(ctx); | ||
const localPlacements = await resolveLocalPlacements(ctx); | ||
const placements = [...remotePlacements, ...localPlacements]; | ||
setOperatorPlacementsAtom(placements); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
setResolving(false); | ||
} | ||
if (!isEqual(lastContext.current, context) && context?.datasetName) { | ||
lastContext.current = context; | ||
updateOperatorPlacementsAtom(); | ||
} | ||
}, [context, setOperatorPlacementsAtom]); | ||
|
||
return { resolving }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.