Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions site/src/api/queries/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const organizationsPermissions = (
organizationIds: string[] | undefined,
) => {
return {
enabled: !!organizationIds,
enabled: Boolean(organizationIds),
queryKey: [
"organizations",
[...(organizationIds ?? []).sort()],
Expand Down Expand Up @@ -351,7 +351,7 @@ export const workspacePermissionsByOrganization = (
userId: string,
) => {
return {
enabled: !!organizationIds,
enabled: Boolean(organizationIds),
queryKey: [
"workspaces",
[...(organizationIds ?? []).sort()],
Expand Down
2 changes: 1 addition & 1 deletion site/src/contexts/useWebpushNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useWebpushNotifications = (): WebpushNotifications => {
try {
const registration = await navigator.serviceWorker.ready;
const subscription = await registration.pushManager.getSubscription();
setSubscribed(!!subscription);
setSubscribed(Boolean(subscription));
} catch (error) {
console.error("Error checking push subscription:", error);
setSubscribed(false);
Expand Down
2 changes: 1 addition & 1 deletion site/src/hooks/useExternalAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useExternalAuth = (versionId: string | undefined) => {
error,
} = useQuery({
...templateVersionExternalAuth(versionId ?? ""),
enabled: !!versionId,
enabled: Boolean(versionId),
refetchInterval: externalAuthPollingState === "polling" ? 1000 : false,
});

Expand Down
2 changes: 1 addition & 1 deletion site/src/modules/apps/useAppLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ export const useAppLink = (
href,
onClick,
label,
hasToken: !!apiKeyResponse?.key,
hasToken: Boolean(apiKeyResponse?.key),
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const WorkspaceDeleteDialog: FC<WorkspaceDeleteDialogProps> = ({
(workspace.latest_build.status === "failed" ||
workspace.latest_build.status === "canceled");

const hasTask = !!workspace.task_id;
const hasTask = Boolean(workspace.task_id);

return (
<ConfirmDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export const WorkspaceMoreActions: FC<WorkspaceMoreActionsProps> = ({

<WorkspaceDeleteDialog
workspace={workspace}
canDeleteFailedWorkspace={!!permissions?.deleteFailedWorkspace}
canDeleteFailedWorkspace={Boolean(permissions?.deleteFailedWorkspace)}
isOpen={isConfirmingDelete}
onCancel={() => {
setIsConfirmingDelete(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useWorkspaceDuplication(workspace?: Workspace) {
const getLink = useLinks();
const buildParametersQuery = useQuery({
...workspaceBuildParameters(workspace?.latest_build.id ?? ""),
enabled: !!workspace,
enabled: Boolean(workspace),
});

// Not using useEffectEvent for this, because useEffect isn't really an
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/AgentsPage/AgentSettingsTemplatesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const AgentSettingsTemplatesPage: FC = () => {
templatesData={templatesQuery.data}
allowlistData={allowlistQuery.data}
isLoading={isLoading}
hasError={!!(templatesQuery.error || allowlistQuery.error)}
hasError={Boolean(templatesQuery.error || allowlistQuery.error)}
onRetry={() => {
void templatesQuery.refetch();
void allowlistQuery.refetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ const ChatMessageInput = ({
initialEditorState={initialEditorState}
/>
<InsertTextPlugin onEditorReady={handleEditorReady} />
<EditableStatePlugin disabled={!!disabled} />
<EditableStatePlugin disabled={Boolean(disabled)} />
{autoFocus && <AutoFocusPlugin />}
</div>
</LexicalComposer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export const DiffViewer: FC<DiffViewerProps> = ({
// When the parent provides per-file callbacks (e.g. line click
// handlers for comment inputs), build options per file. Otherwise
// share a single stable object to avoid unnecessary re-highlights.
const hasPerFileCallbacks = !!(onLineNumberClick || onLineSelected);
const hasPerFileCallbacks = Boolean(onLineNumberClick || onLineSelected);

const getOptionsForFile = (fileName: string) => ({
...diffOptions,
Expand Down
6 changes: 3 additions & 3 deletions site/src/pages/AgentsPage/components/GitPanel/GitPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export const GitPanel: FC<GitPanelProps> = ({
chatInputRef,
}) => {
const hasRemoteStats =
!!remoteDiffStats &&
(remoteDiffStats.additions > 0 || remoteDiffStats.deletions > 0);
(remoteDiffStats?.additions ?? 0) > 0 ||
(remoteDiffStats?.deletions ?? 0) > 0;

const showRemoteTab = !!prTab || hasRemoteStats;
const showRemoteTab = Boolean(prTab) || hasRemoteStats;

const prTitle = remoteDiffStats?.pull_request_title;
const prState = remoteDiffStats?.pull_request_state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const RetentionPeriodSettings: FC<RetentionPeriodSettingsProps> = ({
disabled={
isSavingRetentionDays ||
!form.dirty ||
!!form.errors.retention_days
Boolean(form.errors.retention_days)
}
>
Save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const WorkspaceAutostopSettings: FC<WorkspaceAutostopSettingsProps> = ({
onChange={handleTTLChange}
label="Autostop Fallback"
disabled={isSavingWorkspaceTTL || isWorkspaceTTLLoading}
error={!!fieldError}
error={Boolean(fieldError)}
helperText={fieldError}
/>
)}
Expand All @@ -146,7 +146,9 @@ export const WorkspaceAutostopSettings: FC<WorkspaceAutostopSettingsProps> = ({
<Button
size="sm"
type="submit"
disabled={isSavingWorkspaceTTL || !form.dirty || !!fieldError}
disabled={
isSavingWorkspaceTTL || !form.dirty || Boolean(fieldError)
}
>
Save
</Button>
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = (props) => {

const { data: provisioners } = useQuery({
...provisionerDaemons(selectedOrg?.id ?? ""),
enabled: showOrganizationPicker && !!selectedOrg,
enabled: showOrganizationPicker && Boolean(selectedOrg),
});

// TODO: Ideally, we would have a backend endpoint that could notify the
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/CreateWorkspacePage/CreateWorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const CreateWorkspacePage: FC = () => {
);
const templateVersionPresetsQuery = useQuery({
...templateVersionPresets(templateQuery.data?.active_version_id ?? ""),
enabled: !!templateQuery.data,
enabled: Boolean(templateQuery.data),
});
const permissionsQuery = useQuery({
...checkAuthorization({
Expand All @@ -87,7 +87,7 @@ const CreateWorkspacePage: FC = () => {
templateQuery.data?.id,
),
}),
enabled: !!templateQuery.data,
enabled: Boolean(templateQuery.data),
});
const realizedVersionId =
customVersionId ?? templateQuery.data?.active_version_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const IdpOrgSyncPage: FC = () => {

const fieldValuesQuery = useQuery({
...deploymentIdpSyncFieldValues(field),
enabled: !!field,
enabled: Boolean(field),
});

const patchOrganizationSyncSettingsMutation = useMutation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ const NotificationsPage: FC = () => {
? tabState.value
: NOTIFICATION_TABS[0];

const ready = !!(
systemTemplatesByGroup.data &&
customTemplatesByGroup.data &&
dispatchMethods.data
);
const ready =
systemTemplatesByGroup.data != null &&
customTemplatesByGroup.data != null &&
dispatchMethods.data != null;
// Combine system and custom notification templates
const allTemplatesByGroup = {
...systemTemplatesByGroup.data,
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/GroupsPage/GroupPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const GroupPage: FC = () => {
const groupData = groupQuery.data;
const { data: permissions } = useQuery({
...groupPermissions(groupData?.id ?? ""),
enabled: !!groupData,
enabled: Boolean(groupData),
});
const deleteGroupMutation = useMutation(
deleteGroup(queryClient, organization),
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/GroupsPage/GroupsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const GroupsPage: FC = () => {
const { organization, showOrganizations } = useGroupsSettings();
const groupsQuery = useQuery({
...groupsByOrganization(organization?.name ?? ""),
enabled: !!organization,
enabled: Boolean(organization),
});
const permissionsQuery = useQuery({
...organizationsPermissions([organization?.id ?? ""]),
enabled: !!organization,
enabled: Boolean(organization),
});

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const IdpSyncPage: FC = () => {

const fieldValuesQuery = useQuery({
...organizationIdpSyncClaimFieldValues(organizationName, field),
enabled: !!field,
enabled: Boolean(field),
});

const patchGroupSyncSettingsMutation = useMutation(
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/TaskPage/TaskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ const TaskStartingAgent: FC<TaskStartingAgentProps> = ({ task, agent }) => {
function selectAgent(workspace: Workspace) {
const agents = workspace.latest_build.resources
.flatMap((r) => r.agents)
.filter((a) => !!a);
.filter(Boolean);

return agents.at(0);
}
2 changes: 1 addition & 1 deletion site/src/pages/TemplatePage/TemplateLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const TemplateLayout: FC<PropsWithChildren> = ({
me.id,
),
}),
enabled: !!data,
enabled: Boolean(data),
});

const location = useLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
const { actions, canCancel, canAcceptJobs } = abilitiesByWorkspaceStatus(
workspace,
{
canDebug: !!deployment?.config.enable_terraform_debug_mode,
canDebug: Boolean(deployment?.config.enable_terraform_debug_mode),
isOwner: user.roles.some((role) => role.name === "owner"),
},
);
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacePage/WorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const WorkspacePage: FC = () => {
// Template
const templateQuery = useQuery({
...templateQueryOptions(workspace?.template_id ?? ""),
enabled: !!workspace,
enabled: Boolean(workspace),
});
const template = templateQuery.data;

Expand Down
2 changes: 1 addition & 1 deletion site/src/utils/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Returns true if the current platform is macOS.
*/
function isMac(): boolean {
return !!navigator.platform.match("Mac");
return Boolean(navigator.platform.match("Mac"));
}

/**
Expand Down
Loading