mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-10-26 13:12:25 +03:00
fix high cpu usage
This commit is contained in:
parent
fa3a6271f9
commit
a5c8f02350
@ -12,6 +12,9 @@
|
||||
import { currentProject } from '$lib/current_project';
|
||||
import type { Project } from '$lib/projects';
|
||||
import toast from 'svelte-french-toast';
|
||||
import type { Readable } from 'svelte/store';
|
||||
|
||||
export let projects: Readable<Project[]>;
|
||||
|
||||
let showPalette = <string | false>false;
|
||||
let palette: HTMLElement;
|
||||
@ -33,8 +36,6 @@
|
||||
const switchBranch = (params: { projectId: string; branch: string }) =>
|
||||
invoke<Array<string>>('git_switch_branch', params);
|
||||
|
||||
const listProjects = () => invoke<Project[]>('list_projects');
|
||||
|
||||
const commit = (params: {
|
||||
projectId: string;
|
||||
message: string;
|
||||
@ -240,21 +241,19 @@
|
||||
];
|
||||
|
||||
let switchCommands = [];
|
||||
$: {
|
||||
listProjects().then((projects) => {
|
||||
switchCommands = [];
|
||||
projects.forEach((p) => {
|
||||
if (p.id !== $currentProject?.id) {
|
||||
switchCommands.push({
|
||||
text: p.title,
|
||||
icon: ProjectIcon,
|
||||
command: 'switch',
|
||||
context: p.id
|
||||
});
|
||||
}
|
||||
});
|
||||
projects.subscribe((projects) => {
|
||||
switchCommands = [];
|
||||
projects.forEach((p) => {
|
||||
if (p.id !== $currentProject?.id) {
|
||||
switchCommands.push({
|
||||
text: p.title,
|
||||
icon: ProjectIcon,
|
||||
command: 'switch',
|
||||
context: p.id
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
let baseCommands = [{ text: 'Contact Us', key: 'E', icon: ContactIcon, command: 'contact' }];
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import Breadcrumbs from '$lib/components/Breadcrumbs.svelte';
|
||||
import CommandPalette from '$lib/components/CommandPalette.svelte';
|
||||
import { currentProject } from '$lib/current_project';
|
||||
|
||||
export let data: LayoutData;
|
||||
const { user, posthog, projects } = data;
|
||||
@ -46,5 +45,5 @@
|
||||
<slot />
|
||||
</div>
|
||||
<Toaster />
|
||||
<CommandPalette />
|
||||
<CommandPalette {projects} />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user