Skip to content

fix: 🐛 exportInstallation uses React hook (useInstalledMods) outside component context#123

Merged
LovelessCodes merged 1 commit intoLovelessCodes:releasefrom
vrrdnt:fix/export-installation
Feb 24, 2026
Merged

fix: 🐛 exportInstallation uses React hook (useInstalledMods) outside component context#123
LovelessCodes merged 1 commit intoLovelessCodes:releasefrom
vrrdnt:fix/export-installation

Conversation

@vrrdnt
Copy link
Contributor

@vrrdnt vrrdnt commented Feb 23, 2026

Summary

  • Fixes exportInstallation failing at runtime due to calling a React hook (useInstalledMods) outside of a component context.
  • Replaces the hook call with a direct invoke("get_mods", ...) Tauri command, which is the same underlying data source the hook wraps.

Changes

  • src/lib/utils.ts: Replaced useInstalledMods(installation.path) with await invoke<{ mods: OutputMod[] }>("get_mods", { path: installation.path }). Updated imports accordingly (invoke from @tauri-apps/api/core, OutputMod type).

Related Issues

Screenshots / Demos (if applicable)

N/A — no UI changes. The export installation button now works correctly instead of doing nothing.

Checklist

  • I have linked related issues using #<number>
  • I have updated documentation where appropriate
  • I have verified backward compatibility or noted breaking changes
  • I have run linters/formatters and addressed warnings

Breaking Changes (if any)

None. The exportInstallation function signature is unchanged. Only the internal data-fetching mechanism was replaced.

Additional Context

  • useInstalledMods is a useSuspenseQuery wrapper around the get_mods Tauri command. React hooks cannot be called outside component/hook context, making a direct invoke the correct approach for a standalone utility function.
  • The hook itself is still used and works correctly in install-mods/$id.tsx and mod.list.tsx.

Reviewers

Copy link
Owner

@LovelessCodes LovelessCodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LovelessCodes LovelessCodes merged commit 529f318 into LovelessCodes:release Feb 24, 2026
1 check passed
@vrrdnt vrrdnt deleted the fix/export-installation branch February 28, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants