// If the share was just accepted, the folder might not exist yet.
// In this case, check for the shared item multiple times.
while(!folder&&!event.cancelled){
folder=awaitFolder.load(folderId);
if(folder){
setFolderTitle(folder.title);
break;
}
awaitnewPromise<void>(resolve=>{
shim.setTimeout(()=>resolve(),1000);
});
}
},[folderId]);
returnfolderTitle??'...';
};
constlogger=Logger.create('AcceptedShareItem');
constAcceptedShareItem: React.FC<Props>=props=>{
constinvitation=props.invitation;
constsharer=invitation.share.user;
const[leaving,setLeaving]=useState(false);
// The "leave share" button can be briefly visible after leaving a share.
// When this is the case, keep track of hasLeft to prevent clicking it.
const[hasLeft,setHasLeft]=useState(false);
constonLeaveShare=useCallback(async()=>{
try{
setLeaving(true);
if(awaitshim.showConfirmationDialog(_('This will remove the notebook from your collection and you will no longer have access to its content. Do you wish to continue?'))){