mirror of
https://github.com/silvanocerza/github-gitless-sync.git
synced 2026-07-22 12:10:28 +00:00
Fix issue when rerendering conflict view
This commit is contained in:
parent
2d8ee9f7bd
commit
a1fea0cb95
1 changed files with 9 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ export const CONFLICTS_RESOLUTION_VIEW_TYPE = "conflicts-resolution-view";
|
|||
|
||||
export class ConflictsResolutionView extends ItemView {
|
||||
icon: IconName = "merge";
|
||||
private root: Root | null = null;
|
||||
|
||||
constructor(
|
||||
leaf: WorkspaceLeaf,
|
||||
|
|
@ -44,11 +45,13 @@ export class ConflictsResolutionView extends ItemView {
|
|||
}
|
||||
|
||||
private render(conflicts: ConflictFile[]) {
|
||||
const container = this.containerEl.children[1];
|
||||
container.empty();
|
||||
// We don't want any padding, the DiffView component will handle that
|
||||
(container as HTMLElement).style.padding = "0";
|
||||
const root: Root = createRoot(container);
|
||||
if (!this.root) {
|
||||
const container = this.containerEl.children[1];
|
||||
container.empty();
|
||||
// We don't want any padding, the DiffView component will handle that
|
||||
(container as HTMLElement).style.padding = "0";
|
||||
this.root = createRoot(container);
|
||||
}
|
||||
const App = ({ initialFiles }: { initialFiles: ConflictFile[] }) => {
|
||||
const [files, setFiles] = React.useState(initialFiles);
|
||||
const [resolvedConflicts, setResolvedConflicts] = React.useState<
|
||||
|
|
@ -149,7 +152,7 @@ export class ConflictsResolutionView extends ItemView {
|
|||
</React.StrictMode>
|
||||
);
|
||||
};
|
||||
root.render(<App initialFiles={conflicts} />);
|
||||
this.root.render(<App initialFiles={conflicts} />);
|
||||
}
|
||||
|
||||
async onClose() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue