The entire if-else block can be rewritten as `if (!fullPath || _currentlyViewedPath === fullPath) { ... }`.