fix(diff_commit_merge): delayed commit data load condition

This commit is contained in:
pakintada@gmail.com 2024-03-01 14:33:48 +07:00
parent da353cec84
commit ce7d595427
8 changed files with 278 additions and 131 deletions

View file

@ -41,7 +41,7 @@
</div>
<!-- File Change Status -->
<button onclick="patch_merge_modal.showModal()" *ngIf="showDetectChanges">
<button onclick="patch_merge_modal.showModal()" *ngIf="isCommitLoaded">
<h1 class="text-center font-extrabold text-2xl text-red-500 animate-pulse">Detect Changes! Click</h1>

View file

@ -60,7 +60,8 @@ export class LayoutComponent implements OnInit, OnDestroy {
redisStatus:string = "Offline";
showDetectChanges: boolean = false;
changesCommit: any = undefined;
changesCommit!: any;
isCommitLoaded!: Promise<boolean>;
constructor(
private _userService: UserService,
@ -93,6 +94,12 @@ export class LayoutComponent implements OnInit, OnDestroy {
this._recipeService.getCurrentFile()
).subscribe({
next: async (data: any) => {
console.log("get saved tmp", data);
if(data != null && data != undefined){
this.isCommitLoaded = Promise.resolve(true);
}
if(data != undefined && typeof data === 'object'){
// check if attr exists
if(data.files != null && data.files != undefined){

View file

@ -297,10 +297,10 @@ export class RecipeService {
);
}
async getPatchListOfCurrentFile(
getPatchListOfCurrentFile(
country: string,
filename: string
): Promise<Observable<any>> {
): Observable<any> {
console.log("try get patches", country, filename);