From f1010813912fa54690c153ffa2e168d28f9cb0c3 Mon Sep 17 00:00:00 2001
From: Gustavo S Frehse <gsf20@inf.ufpr.br>
Date: Tue, 20 May 2025 09:38:57 -0300
Subject: [PATCH] Issue #331: UserId no PublisherInfo quebrado

---
 CHANGELOG.md                        | 5 +++++
 package.json                        | 2 +-
 src/app/components/publisherInfo.js | 3 ++-
 src/app/recurso/[id]/page.js        | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42058fcc..15ab5561 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,11 @@ Todas as alterações relevantes deste projeto serão documentadas neste arquivo
 O formato é baseado em [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),  
 e este projeto segue a [Versão Semântica](https://semver.org/lang/pt-BR/spec/v2.0.0.html).
 
+## [1.13.2] - 20/05/2025  
+
+### Corrigido
+  - Bug na página de visualização de recurso.
+
 ## [1.13.1] - 19/05/2025  
 ## Todas as mudanças são introduzidas às sextas-feiras. Mas apenas nas **segundas-feiras** vão para produção.
 
diff --git a/package.json b/package.json
index d5f33b7e..f22f148a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "frontend-mecred",
-  "version": "1.13.1",
+  "version": "1.13.2",
   "private": true,
   "scripts": {
     "dev": "npx next dev",
diff --git a/src/app/components/publisherInfo.js b/src/app/components/publisherInfo.js
index 7d9b837a..ffff4c6d 100644
--- a/src/app/components/publisherInfo.js
+++ b/src/app/components/publisherInfo.js
@@ -16,7 +16,8 @@ export default function PublisherInfo({ publisher, disabledButton = false, userI
   useEffect(() => {
     setFollowed(publisher?.followed ?? false);
     setIsPublisher(publisher["id"] === userId ? true : false)
-  }, [publisher]);
+  }, [publisher, userId]);
+
   if (!publisher) {
     return <></>;
   }
diff --git a/src/app/recurso/[id]/page.js b/src/app/recurso/[id]/page.js
index 4995e066..797ee2b1 100644
--- a/src/app/recurso/[id]/page.js
+++ b/src/app/recurso/[id]/page.js
@@ -136,7 +136,7 @@ export default function Recurso({ params }) {
                 )}
               </div>
               <ActionButtons learningObject={learningObject} setNeedLoginOpen={setNeedLoginOpen} state={state} />
-              <PublisherInfo publisher={learningObject?.publisher} userId={userData.id} />
+              <PublisherInfo publisher={learningObject?.publisher} userId={userData?.id} />
               <ResourceInfo learningObject={learningObject} />
               <Comments learningObjectId={params.id} />
             </div>
-- 
GitLab