Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn about missing Ray, but only once (#14477)
- Loading branch information
Showing
2 changed files
with
15 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
const warnedMap: { [key: string]: boolean } = {}; | ||
/** | ||
* @internal | ||
*/ | ||
export function _WarnImport(name: string) { | ||
export function _WarnImport(name: string, warnOnce = false) { | ||
if (warnOnce && warnedMap[name]) { | ||
return; | ||
} | ||
warnedMap[name] = true; | ||
return `${name} needs to be imported before as it contains a side-effect required by your code.`; | ||
} |
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