Skip to content
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

State explorer panel #15365

Merged
merged 43 commits into from
Jan 29, 2025
Merged

Conversation

PClmnt
Copy link
Collaborator

@PClmnt PClmnt commented Jan 14, 2025

Description

This PR adds the ability to:

  1. Inspect state and locate it's usage through settings. As well as locating where that same state is being updated or created from.
  2. Allow the addition of a default value so that the user can interact with their usages of state within the design preview.

Screenshots

image

Clicking one of the above links will highlight the setting that was selected.

image

If the state variable is in use in the Styles or Conditions tabs, those will automatically switch and highlight the setting there

image

You can set a default value in the panel to be shown or used in the design preview

image

Addresses

https://linear.app/budibase/issue/BUDI-8980/create-state-panel

Feature branch env

Feature Branch Link

Copy link

qa-wolf bot commented Jan 14, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

linear bot commented Jan 14, 2025

@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/m labels Jan 14, 2025
@PClmnt PClmnt changed the title Search components for match state variables and allow user to select and highlight Locate state variable usage and highlight related settings Jan 15, 2025
@github-actions github-actions bot added size/l and removed size/m labels Jan 23, 2025
@PClmnt PClmnt changed the title Locate state variable usage and highlight related settings Panel for interacting with and locating state Jan 23, 2025
@PClmnt PClmnt changed the title Panel for interacting with and locating state State explorer panel Jan 23, 2025
@github-actions github-actions bot added size/m and removed size/l labels Jan 23, 2025
@PClmnt PClmnt added the feature-branch Release this PR code into a feature branch label Jan 24, 2025
Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Pete! The "updates" and "controlled by" jumping to the correct setting and selecting the component feels great 👌

Also love how the values update in real time per key stroke - super responsive.

Code review in progress, but a few usability things I ran in to:

  • The placeholder for the state variable select needs set to something - it defaults to "Type here..." at the moment which is probably the default of one of the underlying components
  • With no state variable selected you can still see the input for setting a value. Touching this throws an error (Uncaught Error: No state key selected). Maybe we should hide the value input if no variable is selected?
  • There's a bit too much padding - the tab content div already provides the right padding, so we can remove the padding around the state panel div.
  • State values don't appear until you leave the tab and go back into it. I think we probably should support this if possible, since you might well have the state panel open while working with state variables, and expect to be able to see them.
  • When a state value is selected, you can still select the placeholder "Type here..." which crashes things. We should remove the placeholder option if there are any valid state variables, to fix this.
  • If I try to use the binding drawer to enter a value, my tab freezes and dies, so I can't test this scenario any further
  • The state variable dropdown seems to search all screens for state variables. This means it will list variables that aren't actually used on the current page, so the usage information is blank. We either need to only list state variables on the current screen, or show usages across all screens.
  • I think it would be a nice UX improvement to automatically select the first available state variable if any exist. Just saves the user a click and prevents seeing an empty state if you don't need to

@@ -32,7 +31,7 @@
$: safeValue = getSafeValue(value, defaultValue, allBindings)
$: replaceBindings = val => readableToRuntimeBinding(allBindings, val)

$: if (!Array.isArray(value)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically disallowed us from highlighting array values, say like an onClick handler. I changed it to this and haven't been able to find any issues arising.

@PClmnt PClmnt added feature-branch Release this PR code into a feature branch and removed feature-branch Release this PR code into a feature branch labels Jan 28, 2025
@aptkingston
Copy link
Member

Good improvements - looks like most of that has been fixed!

Only thing I'm still hitting is that clicking on the placeholder throws a console error
image

I want to clarify with Joe/Ben too if they're happy about the style differences between the state and bindings panels (this is nothing to do with your implementation by the way - it's just how the designs were made to differ from one another).

Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@PClmnt PClmnt merged commit 5749543 into state-and-bindings-panels Jan 29, 2025
19 checks passed
@PClmnt PClmnt deleted the budi-8980-create-state-panel branch January 29, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-branch Release this PR code into a feature branch firestorm Data/Infra/Revenue Team size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants