Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Global live update pause: disable automatic query refreshes on browser focus and reconnect, preventing paused workflow detail pages from re-fetching wait data outside the configured refresh interval. [PR #584](https://github.com/riverqueue/riverui/pull/584).
- Job detail: preserve line breaks in attempt logs while keeping structured JSON viewer content outside preformatted code markup. [PR #592](https://github.com/riverqueue/riverui/pull/592).
- Autocomplete: correctly use the River client's configured schema when querying job kinds and queue names.

## [v0.16.0] - 2026-05-19

Expand Down
2 changes: 2 additions & 0 deletions handler_api_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (a *autocompleteListEndpoint[TTx]) Execute(ctx context.Context, req *autoco
Exclude: req.Exclude,
Match: match,
Max: 100,
Schema: a.Client.Schema(),
})
if err != nil {
return nil, fmt.Errorf("error listing job kinds: %w", err)
Expand All @@ -133,6 +134,7 @@ func (a *autocompleteListEndpoint[TTx]) Execute(ctx context.Context, req *autoco
Exclude: req.Exclude,
Match: match,
Max: 100,
Schema: a.Client.Schema(),
})
if err != nil {
return nil, fmt.Errorf("error listing queue names: %w", err)
Expand Down
39 changes: 35 additions & 4 deletions handler_api_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type setupEndpointTestBundle struct {
client *river.Client[pgx.Tx]
exec riverdriver.ExecutorTx
logger *slog.Logger
schema string
tx pgx.Tx
}

Expand All @@ -43,10 +44,10 @@ func setupEndpointWithOpts[TEndpoint any](ctx context.Context, t *testing.T, ini
t.Helper()

var (
logger = riversharedtest.Logger(t)
driver = riverpgxv5.New(riversharedtest.DBPool(ctx, t))
tx, _ = riverdbtest.TestTxPgxDriver(ctx, t, driver, opts)
exec = driver.UnwrapExecutor(tx)
logger = riversharedtest.Logger(t)
driver = riverpgxv5.New(riversharedtest.DBPool(ctx, t))
tx, schema = riverdbtest.TestTxPgxDriver(ctx, t, driver, opts)
exec = driver.UnwrapExecutor(tx)
)

client, err := river.NewClient(driver, &river.Config{
Expand All @@ -72,6 +73,7 @@ func setupEndpointWithOpts[TEndpoint any](ctx context.Context, t *testing.T, ini
client: client,
exec: exec,
logger: logger,
schema: schema,
tx: tx,
}
}
Expand Down Expand Up @@ -174,6 +176,35 @@ func runAutocompleteTests(t *testing.T, facet autocompleteFacet, setupFunc func(
require.Len(t, resp.Data, 1)
require.Equal(t, "alpha_task", *resp.Data[0])
})

t.Run("WithCustomSchema", func(t *testing.T) {
t.Parallel()

endpoint, bundle := setupEndpoint(ctx, t, newAutocompleteListEndpoint)
client, err := river.NewClient(endpoint.Driver, &river.Config{
Logger: bundle.logger,
Schema: bundle.schema,
})
require.NoError(t, err)
endpoint.Client = client

setupFunc(t, bundle)

// Ensure autocomplete uses the client's configured schema instead of the
// transaction's search path.
_, err = bundle.tx.Exec(ctx, "SET LOCAL search_path TO public")
require.NoError(t, err)

resp, err := apitest.InvokeHandler(ctx, endpoint.Execute, testMountOpts(t), &autocompleteListRequest{
Facet: facet,
})
require.NoError(t, err)
require.Len(t, resp.Data, 4)
require.Equal(t, "alpha_"+facet.baseString(), *resp.Data[0])
require.Equal(t, "alpha_task", *resp.Data[1])
require.Equal(t, "beta_"+facet.baseString(), *resp.Data[2])
require.Equal(t, "gamma_"+facet.baseString(), *resp.Data[3])
})
}

func (f autocompleteFacet) baseString() string {
Expand Down