🗨️ refactor: Only Allow Prompt Queries with Access (#9688)

This commit is contained in:
Danny Avila 2025-09-18 10:00:33 -04:00 committed by GitHub
parent 02bfe32905
commit 208be7c06c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 64 additions and 38 deletions

View file

@ -167,6 +167,7 @@ const PromptForm = () => {
const params = useParams();
const localize = useLocalize();
const { showToast } = useToastContext();
const { hasAccess } = usePromptGroupsContext();
const alwaysMakeProd = useRecoilValue(store.alwaysMakeProd);
const promptId = params.promptId || '';
@ -179,10 +180,12 @@ const PromptForm = () => {
const [showSidePanel, setShowSidePanel] = useState(false);
const sidePanelWidth = '320px';
const { data: group, isLoading: isLoadingGroup } = useGetPromptGroup(promptId);
const { data: group, isLoading: isLoadingGroup } = useGetPromptGroup(promptId, {
enabled: hasAccess && !!promptId,
});
const { data: prompts = [], isLoading: isLoadingPrompts } = useGetPrompts(
{ groupId: promptId },
{ enabled: !!promptId },
{ enabled: hasAccess && !!promptId },
);
const { hasPermission, isLoading: permissionsLoading } = useResourcePermissions(