Repository navigation
[BREAKINGCHANGE] plugin-system: remove unused QueryEditorProps<Spec> type - #443
Open
armnkumar321-spec wants to merge 1 commit into
Open
armnkumar321-spec wants to merge 1 commit into
armnkumar321-spec wants to merge 1 commit into
Conversation
…type Remove the exported generic QueryEditorProps<Spec> interface from plugin-system/src/model/plugin-base.ts, together with the QueryDefinition import that only that interface used. The type was re-exported from the @perses-dev/plugin-system public entry point, but nothing in perses/shared, perses/plugins, perses/perses or perses/examples-plugin uses it, and the plugin runtime never passes a `queries` prop to editor components. Plugins that imported it should type their editors with OptionsEditorProps<Spec>, which is what the official query plugins already use. The separate, non-exported QueryEditorProps interface in MultiQueryEditor/QueryEditorContainer.tsx is unchanged. Refs perses/perses#3202 Signed-off-by: Aman Kumar <246823277+armnkumar321-spec@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes perses/perses#3202
Warning
Breaking change. This removes a type from the public API of
@perses-dev/plugin-system. As agreed in perses/perses#3202, it is removed outright with no deprecation period.This removes the exported generic
QueryEditorProps<Spec>interface fromplugin-system/src/model/plugin-base.ts, along with itsQueryDefinitionimport. Nothing else in that file used the import.What this PR does not change:
QueryEditorPropsinplugin-system/src/components/MultiQueryEditor/QueryEditorContainer.tsxstays. It's a separate, non-exported interface with a different shape (queryTypes,value: QueryDefinition,onQueryRun, …), andQueryEditorstill uses it.model/index.ts→src/index.ts) are left alone. The type simply stops being exported through them.Why the removal is safe
QueryEditorProps(grep -rnw) matches only the local interface inQueryEditorContainer.tsx. Nothing referenced the exported one.gh search code "QueryEditorProps" --owner persesreturns 26 files outside this repo, inperses/plugins,perses/perses(CLI test data) andperses/examples-plugin. Every hit is a substring match on a plugin's own type, such asLokiQueryEditorPropsorTraceQueryEditorProps. An exact-word grep on fresh shallow clones of all three repos found no uses.PluginSpecEditorrenders<OptionsEditorComponent {...others} value={value} />and never passes aqueriesprop. So an editor typed withQueryEditorProps<Spec>would never have receivedqueries. The type described a contract the runtime didn't honour.Migration notes (for the release notes)
QueryEditorProps<Spec>removed from@perses-dev/plugin-systemThe exported
QueryEditorProps<Spec>type has been removed. It extendedOptionsEditorProps<Spec>with aqueries: QueryDefinition[]field, which the plugin runtime never filled in.Third-party plugins that import it will get a TypeScript error such as
Module '"@perses-dev/plugin-system"' has no exported member 'QueryEditorProps'. To migrate, useOptionsEditorProps<Spec>, which the official query plugins (Prometheus, Loki, Tempo, …) already use:If your editor read
props.queries, it was alwaysundefinedat runtime, so you can delete that code. There's no runtime behaviour change.The
QueryEditorcomponent and the propsMultiQueryEditoruses internally are unchanged.Verification
Run locally on top of
main(169bfa3) afternpm ci:npm run format:checknpm run lintnpm run type-checknpm run buildnpm run testMultiQueryEditor.test.tsxandQueryEditorContainer.test.tsx), explore 7/7 (see note)plugin-system/dist/model/plugin-base.d.tsno longer declaresQueryEditorProps; no.d.tsunderplugin-system,dashboardsorexploredist/references itmake checklicenseNote on
explore: my machine has Node 26.3.0 instead of the pinned 24.19.0. On Node 26, Node's built-inlocalStorageglobal shadows jsdom's, so 5ExploreManager.test.tsxtests fail withCannot read properties of undefined (reading 'setItem'). The same 5 tests fail the same way on unmodifiedmain, so this PR didn't cause them. WithNODE_OPTIONS=--no-experimental-webstorage, all 7exploretests pass on this branch.Screenshots
N/A: type-only change, no UI impact.
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes