feat: Wiki 有無判定軽量化(#233) (#234)

#233 Backend が対応できてなかったのでそっちも対応させた.

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #234
This commit was merged in pull request #234.
This commit is contained in:
2026-01-23 01:08:27 +09:00
parent f6de272f55
commit ef3d428a06
4 changed files with 31 additions and 14 deletions
+10 -2
View File
@@ -32,7 +32,15 @@ export default (({ tag,
...props }: Props) => {
const [havingWiki, setHavingWiki] = useState (true)
const wikiExists = async (tagName: string) => {
const wikiExists = async (tag: Tag) => {
if ('hasWiki' in tag)
{
setHavingWiki (tag.hasWiki)
return
}
const tagName = (tag as Tag).name
try
{
await axios.get (`${ API_BASE_URL }/wiki/title/${ encodeURIComponent (tagName) }/exists`)
@@ -48,7 +56,7 @@ export default (({ tag,
if (!(linkFlg) || !(withWiki))
return
wikiExists (tag.name)
wikiExists (tag)
}, [tag.name, linkFlg, withWiki])
const spanClass = cn (