Skip to content

fix: only apply the environment filter to project types that have it - #8564

Open
ThreadCrash wants to merge 1 commit into
modrinth:mainfrom
ThreadCrash:fix/environment-filter-unsupported-types
Open

ThreadCrash wants to merge 1 commit into
modrinth:mainfrom
ThreadCrash:fix/environment-filter-unsupported-types

Conversation

@ThreadCrash

Copy link
Copy Markdown
Contributor

Fixes #8135

The Environment filter type is only defined for mod and modpack, so on the other tabs newFilters skips an environment value with "Filter type environment not found". The environment facet block below that loop reads the raw filter values directly, though, so it still adds the client/server environment condition for shaders, resource packs, datapacks and plugins.

In the app, instanceFilters provides an environment: client filter for server instances on every project type except resource packs. A client filter set on the Mods tab also carries over to the Shaders tab, which is why the workaround in the issue is to remove it on the Mods tab first. On the Shaders tab the filter type isn't shown, so the filter can't be seen or removed there.

On the live search API, project_types = "shader" gives 1143 results, and adding the client environment condition leaves 6. With the instance's game version filter on top, you get the single shader from the issue.

This only adds the environment facet when the Environment filter type is available for the current project types. The environment override for server content is unchanged.

Testing

In Storybook I called useSearch with a provided environment: client filter and printed newFilters for each project type:

  • before: shader and resourcepack both got the environment = ... condition
  • after: shader and resourcepack give just project_types = ..., and mod and modpack keep the environment condition as before

eslint and prettier pass on the file. I can't build the app here, so I haven't clicked through it in the app itself.

The Environment filter type only exists for mods and modpacks, so on other
tabs its value is skipped when building the filters. The environment facet
was still added from the raw filter values, though. A client filter picked on
the Mods tab, or the one the app provides for a server instance, then kept
applying on the Shaders tab, where it can't be seen or removed and leaves only
a handful of shaders.

Add the environment facet only when the Environment filter type is available
for the current project types.
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Dec 5, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Irregular shader packs filtering when installed through Modrinth server listing

2 participants