insightsengineering / insightsengineering/teal.slice

[Bug]: filter state changes on app start

Open
#577 0 comments 0 reactions 0 assignees View on GitHub
bug core
Dominant language
R
Stars
12
Forks
7
Avg merge
3d 31m
Merged PRs (30d)
1

Description

### What happened?

When specifying initial filters, enumerating factor levels in a non-alphabetical order causes the app to change the filter state, which results in filter state history before the user changes the filter.

```
library(teal)

filter <- teal_slices(
teal_slice("i", "Species", selected = c("virginica", "versicolor"))
)

data <- teal_data() |> within({
i <- iris
m <- mtcars
f <- faithful
})
app <- init(data, example_module(), filter)

runApp(app)

```

![image](https://github.com/insightsengineering/teal.slice/assets/114988527/c90cb496-fe1a-45e8-8df5-b619504f3be0)

After changing `filter` to
```
filter <- teal_slices(
teal_slice("i", "Species", selected = c("versicolor", "virginica"))
)
```

![image](https://github.com/insightsengineering/teal.slice/assets/114988527/20cac00f-f96e-47dd-af98-a85cfb97ab28)

### sessionInfo()

_No response_

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [X] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [X] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.