Code Monkey home page Code Monkey logo

Comments (3)

britzl avatar britzl commented on July 18, 2024

Thank you for the bug report! What is the best and easiest way to reproduce the problem?

from gooey.

magroader avatar magroader commented on July 18, 2024

Here is my basic setup:

	local list = gooey.dynamic_list(list_id, list_stencil, list_item_template, items)
	for i,item in ipairs(list.items) do
		if item.data then
			-- populate my gui nodes with data from item.data
		end
	end

If items has anything in it during one call to this, then later items has everything removed from it, then you will still get into the inner if statement, but with stale data that used to be, but is no longer, in the items list.

The gui does get disabled in this case, so the stale data isn't actually visible. However, the inner check does happen, so I need to actually detect that the data is stale (and not do anything that might crash).

The only reason I even noticed this was because I had a list of guid keys that I was using, and I was populating the gui based on data retrieved from a separate system keyed off those guids. The data retrieval returned nil (because the data had been removed), I tried to pass nil to a gui.set_text() call, and it crashed. I eventually traced it back to gooey giving me the stale data despite that data NOT being in the items list I passed.

I worked around it by doing this:

	if #items == 0 then
		-- Bug in gooey if no items - it was keeping the item.data property around but invalid
		-- https://github.com/britzl/gooey/issues/59
		for i=1,#list.items do
			list.items[i].data = nil
		end		
	end

However, after submitting this bug, I found this ALSO happens when items are removed from an overly full list - I had like 10 things in my list, and I deleted a few, and during one of these deletions I once again hit a case where items.data was stale. I suspect the overall list could hold N items, and when dropping down to N-1 pieces of data, I started to get stale data that wasn't in the array passed.

from gooey.

britzl avatar britzl commented on July 18, 2024

Thanks, I'll look into it during the week.

from gooey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.