question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't detect changes for functions that generate DOM component changes

See original GitHub issue

I have a component which has a class. I have noticed that reloading does not work if a function contained in a component has code which is changed. Example:

class MainApp extends Component
{
    constructor(props)
    {
        super(props);

        this.DOM =
        {
            G :     // generator functions
            {
                contactButton : (p)=>
                {
                    return (
                        <Button className={this.classes.contactButtonContainer}
                            onClick={()=> {location.href = p.url}}>
                            <i className={p.className}/>
                        </Button>
                    );
                }
            }
        };
    }
    render ()
    {
        return (
                <div className="appWrapper">
                    <div className="mainContent">
                        <AppHeader/>
                        <div>- insert body content here -</div>
                    </div>
                    <div className="appFooter">
                        {this.DOM.G.contactButton(
                        {
                            className : 'mdi mdi-github-box',
                            url       : 'http://somewhere'
                        })}
                        {this.DOM.G.contactButton(
                            {
                                className : 'rc3 rc3-npm-box',
                                url       : 'http://somewhere'
                            })}
                        {this.DOM.G.contactButton(
                            {
                                className : 'mdi mdi-code-tags',
                                url              : 'http://somewhere''
                            })}
                    </div>
                </div>
                );
        }
}

If I edit the definition of this.DOM.G.contactButton, no changes are detected when reloading. Also to note, I am using Redux & ReactRouter (@next/latest for each). I was very careful to set up each and require the proper middleware, but I’m not sure if this is an issue with that at this point.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ThisIsRuddycommented, May 31, 2017

Just got merged 😊

1reaction
rob2dcommented, Mar 27, 2017

Thanks for the thoughtful reply. I have actually resorted to doing just that. One reason why I had done things this way is material-ui now uses JSS and has to be compiled with a context binded to the style for classNames (I mean, I don’t have to use JSS, but for the sake of consistency within these apps). I’m not sure if the technology within JSS that re-writes CSS to the DOM would have slowdown with more sheets generated per render to do that.

But I guess a little more boiler-plate here and there won’t be the end of the world. Thanks 😄 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Detect changes in the DOM - javascript - Stack Overflow
I want to execute a function when some div ...
Read more >
Angular Change Detection - How Does It Really Work?
By default, Angular Change Detection works by checking if the value of template expressions have changed. This is done for all components. We ......
Read more >
How JavaScript works: tracking changes in the DOM using ...
MutationObserver is a Web API provided by modern browsers for detecting changes in the DOM. With this API one can listen to newly...
Read more >
The Last Guide For Angular Change Detection You'll Ever Need
This mechanism of syncing the HTML with our data is called "Change Detection". Each frontend framework uses its implementation, e.g. React uses Virtual...
Read more >
Simplified Angular Change Detection | by Pankaj Parkar | ngconf
Implementation of the tick method looks pretty simple. It basically loops over each view (components are internally referred to as view) and calls...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found