Skip to content

Commit

Permalink
EES 5633 - FE - Redirect the user to the latest version of a page if …
Browse files Browse the repository at this point in the history
…using an old Release slug in the URL (#5419)

* EES-5633 Refactoring the redirect logic to capture release redirects, and to allow us to define more accurately which routes we expect redirects for

* EES-5633 Fixing URLPattern Regex + Adding Jest tests + Fixing bug where we weren't isolating a module between test runs

The module state (cache) of the `redirectPages` module was interfering with subsequent runs of the tests. So we have used Jest's built-in `isolateModulesAsync` method to ensure that the module state is not carried over between test runs.

* EES-5633 Adding tests for child-routes that aren't accounted for in the redirect patterns + organising tests into groups

* EES-5633 Removing comments

* EES-5633 Refactoring to allow releases to have the same slugs across different publications

* EES-5633 Simplifying business logic

* EES-5633 Fixing FE test

* EES-5633 Removing invalid fast-track and permalink routes

* EES-5633 Removing the `/data-tables/{publication-slug}` path from the list of matched redirect URL Patterns

* EES-5633 Adding the `/data-tables/{publication-slug}` path back into the list of matched redirect URL Patterns

* EES-5633 Removing Lodash usage in middleware to fix build error

Was previously getting this error when running `pnpm run build` in the frontend project:

```
Failed to compile.

./..\..\node_modules\.pnpm\[email protected]\node_modules\lodash\lodash.js
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

Import trace for requested module:
  ./..\..\node_modules\.pnpm\[email protected]\node_modules\lodash\lodash.js
  ./src\middleware\pages\redirectPages.ts
  ./src\middleware.ts
```

* EES-5633 Removing unnecessary null check
  • Loading branch information
jack-hive authored Dec 16, 2024
1 parent 449fea2 commit dee7e0c
Show file tree
Hide file tree
Showing 3 changed files with 787 additions and 284 deletions.
Loading

0 comments on commit dee7e0c

Please sign in to comment.