Skip to content

Commit

Permalink
Removed in page callback (#6657)
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored Feb 10, 2025
1 parent 61c709b commit 707cb07
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe("AccountSettingsModal", () => {
agent: "CodeActAgent",
confirmation_mode: false,
enable_default_condenser: false,
github_token: undefined,
language: "en",
llm_base_url: "",
llm_model: "anthropic/claude-3-5-sonnet-20241022",
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/context/auth-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ interface AuthContextType {
setGitHubTokenIsSet: (value: boolean) => void;
}

interface AuthContextProps extends React.PropsWithChildren {
initialGithubTokenIsSet?: boolean;
}

const AuthContext = React.createContext<AuthContextType | undefined>(undefined);

function AuthProvider({ children }: React.PropsWithChildren) {
const [githubTokenIsSet, setGitHubTokenIsSet] = React.useState(false);
function AuthProvider({ children, initialGithubTokenIsSet }: AuthContextProps) {
const [githubTokenIsSet, setGitHubTokenIsSet] = React.useState(
!!initialGithubTokenIsSet,
);

const value = React.useMemo(
() => ({
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/hooks/query/use-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,5 @@ export const useSettings = () => {
setGitHubTokenIsSet(!!query.data?.GITHUB_TOKEN_IS_SET);
}, [query.data?.GITHUB_TOKEN_IS_SET, query.isFetched]);

// Return default settings if in SAAS mode and not authenticated
if (config?.APP_MODE === "saas" && !githubTokenIsSet) {
return {
...query,
data: DEFAULT_SETTINGS,
};
}

return query;
};
2 changes: 0 additions & 2 deletions frontend/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ export default [
route("served", "routes/app.tsx"),
]),
]),

route("oauth/github/callback", "routes/oauth.github.callback.tsx"),
] satisfies RouteConfig;
39 changes: 0 additions & 39 deletions frontend/src/routes/oauth.github.callback.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function renderWithProviders(
function Wrapper({ children }: PropsWithChildren) {
return (
<Provider store={store}>
<AuthProvider>
<AuthProvider initialGithubTokenIsSet={true}>
<QueryClientProvider
client={
new QueryClient({
Expand Down

0 comments on commit 707cb07

Please sign in to comment.