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

Combo breaks if not rendered while opened #88

Open
OverHash opened this issue Jan 4, 2025 · 1 comment · May be fixed by #89
Open

Combo breaks if not rendered while opened #88

OverHash opened this issue Jan 4, 2025 · 1 comment · May be fixed by #89
Labels
bug Something isn't working help wanted Extra attention is needed investigating Needs more investigation to determine nature

Comments

@OverHash
Copy link
Contributor

OverHash commented Jan 4, 2025

Consider the following code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Iris = require(ReplicatedStorage.Iris)

local Iris = Iris.Init()
Iris:Connect(function()
	local hasSelectedYet = Iris.State(nil)
	
	Iris.Window() do
		if not hasSelectedYet:get() then
			Iris.Combo({"My nice combo"}) do
				Iris.Selectable({"Select me", true}, { index = hasSelectedYet })
			end

			Iris.End()
		end
		
		Iris.End()
	end
end)

This code breaks Iris by removing a Combo while the dropdown is still open.

This happens by the user selecting "Select me" (from the dropdown open), which sets hasSelectedYet = true. The next Iris cycle will therefore not run the Iris.Combo() logic again, which causes the Combo to not render.

Unfortunately, this creates a problem today in Iris:

Before clicking "Select me":
image

After clicking "Select me":
image

(notably, the selection frame should not be there).

Additionally, clicking the selection frame causes an error:

  13:14:38.958  PreviewContainer is not a valid member of Frame "Iris_Combo"  -  Client - Combo:177
  13:14:38.958  Stack Begin  -  Studio
  13:14:38.958  Script 'ReplicatedStorage.Iris.widgets.Combo', Line 177  -  Studio - Combo:177
  13:14:38.959  Stack End  -  Studio

Even closing the Window will retain the PlayerGui.PopupScreenGui.ComboContainer instance.

@OverHash
Copy link
Contributor Author

OverHash commented Jan 4, 2025

For the second issue, it looks like it's caused by Iris running

widgets.registerEvent("InputBegan", function(inputObject: InputObject)
  -- ...
end)

and importantly, when we "delete" the active Combo, Iris won't reset the state to be as though nothing is opened.

I modified the Combo script and will open a PR, but I'm not sure if it's a fool-proof fix.

@OverHash OverHash linked a pull request Jan 4, 2025 that will close this issue
@SirMallard SirMallard added bug Something isn't working help wanted Extra attention is needed investigating Needs more investigation to determine nature labels Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed investigating Needs more investigation to determine nature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants