maryvilledev / codesplainUI

Web app for breaking down and annotating Python 3 source code.
https://www.codesplain.io
GNU General Public License v3.0
2 stars 2 forks source link

Add check when loading new parser for differing filters #540

Closed solkaz closed 7 years ago

solkaz commented 7 years ago

Description

When loading a new parser, checks if the new filters returned from removeDeprecatedFiltersFromState differs from the old filters; if it hasn't changed, then restoreState will not be dispatched

Motivation and Context

Minor optimization

Checklist:

Browsers

thebho commented 7 years ago

What exactly does this fix?

solkaz commented 7 years ago

Currently, when a new parser is loaded, removeDeprecatedFiltersFromState will be called on the current app state, and then restoreState will be dispatched after that. This is unnecessary if the filters object hasn't changed, though, so this adds a check to see if it's necessary to call restoreState, which can prevent an unnecessary re-render

solkaz commented 7 years ago

It's just an optimization, it doesn't "fix" any bugs