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.

Remove unused legacy JS code after removal of legacy components and data API

See original GitHub issue

Now that all legacy widget components have been removed (see #1997 and #2077) and the legacy data API as well (see #2258), we should go through the JS codebase again (after a similar issue earlier, #2418) and look for unused code that can be removed.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Any code including or only intended for use with legacy dashboard widgets or the legacy dataAPI should be removed (example)

Most of the definition here will be searching through the codebase.

  • Note: all of this will likely not be used anymore, but if it is please note what it is in the IB with suggested replacement (if any)
  • Check through all module components, and review uses of addAction and addFilter to make sure any remaining uses are still valid
  • Ensure references to the old /data REST endpoint are removed (e.g in E2E request interception - search for v1/data)
  • Review all TODO comments to ensure there are none left in the code that are actionable related to the removed legacy widgets and dataAPI

Implementation Brief

(See #3799 for a PR that removes request interception in E2E tests as a starting point for this issue.)

Test Coverage

  • No tests should need removing or changing; existing tests should all pass.

Visual Regression Changes

  • N/A

QA Brief

  • Ensure assets/js/components/SignIn.js is gone.
  • Ensure no calls to ‘v1/data’ are made.
  • Ensure AC are met.

Changelog entry

  • Remove unused legacy JS code after removal of legacy components and data API

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
felixarntzcommented, Aug 5, 2021

@tofumatt @aaemnnosttv IB also LGTM from my end - I think it’s reasonable to make the one Tag Manager API change as well, even though that is technically a breaking change on the server-side since we’re changing the default. Should be okay this time though.

1reaction
tofumattcommented, Aug 4, 2021

Ah, I thought that controlCallback was a safe change to make but didn’t realise the PHP part wasn’t already done. I’ve added that bit to the IB and removed some of the more aggressive changes or changes to files I thought weren’t in use but I missed their imports.

Should be ready for another look, thanks! 👍🏻

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove legacy data API and legacy higher-order components ...
The legacy data API and the legacy higher-order components withData and addToFilter should be removed once they are no longer used.
Read more >
Lighthouse: Reduce unused JavaScript - GTmetrix
Dead code elimination is the process of removing JavaScript code that isn't used by your current page. This code may contain remnants from...
Read more >
How to find dead code in a large react project? - Stack Overflow
Solution: For node projects, run the following command in your project root: npx unimported. If you're using flow type annotations, ...
Read more >
Legacy Context - React
The legacy context API will be removed in a future major version. ... The following code shows a Button component written as a...
Read more >
Deprecated and obsolete features - JavaScript - MDN Web Docs
These features are likely stable because removing them will cause backward compatibility issues and break legacy websites. (JavaScript has ...
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