-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fixes #406
Bug fixes #406
Conversation
theseus/src/state/projects.rs
Outdated
impl Dependency { | ||
// As Modrinth doesn't always provide the project ID, we have to infer it from the version ID | ||
pub async fn populate(&mut self) -> crate::Result<()> { | ||
let mut dep = self; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this IMO is a pretty bad way of solving this specific issue. I think you can remove the fix for this GH issue and I can fix this one
#[tauri::command] | ||
pub async fn profile_get_installed_duplicate_nonversional_dependencies( | ||
path: ProfilePathId, | ||
mut dependencies: Vec<Dependency>, | ||
) -> Result<Vec<Dependency>> { | ||
use futures::prelude::*; | ||
|
||
// Not all dependencies have a project id, so we need to check if the project id is None and populate it | ||
// using try_for_each_concurrent, and running .populate() on each dependency | ||
let stream = futures::stream::iter(dependencies.iter_mut()) | ||
.map(Ok::<_, theseus::Error>); | ||
|
||
stream | ||
.try_for_each_concurrent(None, |dependency| async move { | ||
dependency.populate().await?; | ||
Ok(()) | ||
}) | ||
.await?; | ||
|
||
// Iterate over all projects in the profile, and check if any of the dependencies are installed with a different version | ||
let mut duplicates = Vec::new(); | ||
let profile = profile_get(path, None).await?; | ||
if let Some(profile) = profile { | ||
profile.projects.into_iter().for_each(|(_, project)| { | ||
if let ProjectMetadata::Modrinth { | ||
project, version, .. | ||
} = &project.metadata | ||
{ | ||
dependencies.iter().for_each(|dependency| { | ||
if dependency.version_id != Some(version.id.clone()) | ||
&& dependency.project_id == Some(project.id.clone()) | ||
{ | ||
duplicates.push(dependency.clone()); | ||
} | ||
}) | ||
} | ||
}); | ||
} | ||
Ok(duplicates) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Don't like this fix (quite a lot of code smell imo). I'll fix this in my auth PR so I think this can be removed from this PR
theseus_gui/src/helpers/profile.js
Outdated
export async function check_duplicate_nonversional_dependencies(path, dependencies) { | ||
return await invoke('plugin:profile|profile_get_installed_duplicate_nonversional_dependencies', { | ||
path, | ||
dependencies, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also can be removed
theseus_gui/src/helpers/utils.js
Outdated
// if duplicates has a version that matches, skip | ||
if (duplicates.find((d) => d.version_id === dep.version_id)) continue | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
theseus_gui/src/helpers/utils.js
Outdated
const duplicates = await check_duplicate_nonversional_dependencies( | ||
profile.path, | ||
version.dependencies | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed
onlyOpenSource.value = false | ||
selectedVersions.value = [] | ||
selectedEnvironments.value = [] | ||
await onSearchChange(1) | ||
await onSearchChangeToTop(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why were these and others changed to to top? these operations should not affect the scroll pos
for (const file of event.payload) { | ||
await add_project_from_path(props.instance.path, file, 'mod').catch(handleError) | ||
} | ||
initProjects(await get(props.instance.path).catch(handleError)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mixpanel needs to be added in this else statement as well, or at least moved out of this
Fixes #230
Fixes #234
Fixes #290
Fixes #313
Fixes #382
Fixes #388
Fixes #396
Fixes #399
Fixes #400
Fixes #407
Fixes permissions in Info.plist for voice chat on Mac
Fixes deadlock preventing app closing via safeprocesses
Potential fix for title bar issues