Skip to content

Commit

Permalink
Merge pull request #914 from searchspring/beforeFind-fix
Browse files Browse the repository at this point in the history
`beforeFind` Fix
  • Loading branch information
korgon authored Oct 11, 2023
2 parents 131f22e + 936e184 commit 462e30f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/snap-controller/src/Finder/FinderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ export class FinderController extends AbstractController {
finder.controller.store.loading = false;
});

this.eventManager.on('beforeFind', async (finder: { controller: FinderController }, next: Next): Promise<void | boolean> => {
await next();

window.location.href = this.urlManager.href;
});

// attach config plugins and event middleware
this.use(this.config);

Expand Down Expand Up @@ -115,6 +109,9 @@ export class FinderController extends AbstractController {
await this.eventManager.fire('beforeFind', {
controller: this,
});

// redirect to configured URL after middleware completes
window.location.href = this.urlManager.href;
} catch (err: any) {
if (err?.message == 'cancelled') {
this.log.warn(`'beforeFind' middleware cancelled`);
Expand Down

0 comments on commit 462e30f

Please sign in to comment.