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

Make a 'just changed' cell. #27

Open
braxtonmckee opened this issue Jul 11, 2019 · 4 comments
Open

Make a 'just changed' cell. #27

braxtonmckee opened this issue Jul 11, 2019 · 4 comments

Comments

@braxtonmckee
Copy link
Contributor

It would be nice if we could make a cell that temporarily highlights (and then fades away) whenever anything inside of it gets updated. For instance,

cells.ChangeHighlight(cells.Subscribed(lambda: someSlot.get()))

would show the contents of the slot, and any time it changes, flash an outline around the cell for 500 ms, say.

@darth-cheney
Copy link
Contributor

Are you imagining something like a border transition/animation, where the border temporarily "highlights" and then fades away?

@braxtonmckee
Copy link
Contributor Author

braxtonmckee commented Jul 11, 2019 via email

@darth-cheney
Copy link
Contributor

After starting to work on this problem, I've come up with a couple of questions. What do we mean by "update" here?

If we mean that the value of a slot's data has changed, then we are going to need some methods for reflection on Cells that allow us to see which Slots they have at any moment during their lifetimes. Then we can determine which props we pass (ie exportData items) require notification of updates.

If we simply mean that whenever the visual contents of some Cell change, then we have a different problem which is DOM related. In this case "change" can be a child of a child of a child whose contents have changed (and which manifests itself visually), and which, at the moment, triggers all kinds of re-renderings and DOM updates.

One final option -- and right now I think it's the best one -- is to simply kick the can on this Cell until we have removed the "replacements method" of updating the UI. In this near-future system, updates are sent to individual Cells specifically (when they have been recalculated), so we will know which ones have been updated or not. We can then build the ability to "flash" whenever the Component receives an update message into all components, but only "activate" this capability when some parameters have changed -- parameters that will be adjusted by the wrapping function cells.ChangeHighlight(). In other words, ChangeHighlight will tell the enclosed Cell that it's UI component should activate flashing whenever it updates, and "update" here is anything that triggered a re-render.

@braxtonmckee
Copy link
Contributor Author

yeah we don't have to do this now, but i wanted to keep track of it.

the simplest way in my mind would be to have all cells know their parent and walk up the tree any time a cell changes and trigger an action on any parent that wants to know when it changes. A simpler alternative would be to have this be an option we place on 'Subscribed' cels and only trigger it when the "Subscribed" rebuilds itself. not as flexible, but would cover most cases.

@braxtonmckee braxtonmckee transferred this issue from APrioriInvestments/typed_python Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants