Browse Source

Bug fix for search

imwald
Nuša Pukšič 7 months ago
parent
commit
8a8cf7bb2c
  1. 52
      composer.lock
  2. 16
      src/Twig/Components/SearchComponent.php

52
composer.lock generated

@ -476,16 +476,16 @@ @@ -476,16 +476,16 @@
},
{
"name": "doctrine/dbal",
"version": "4.2.3",
"version": "4.2.4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e"
"reference": "b37d160498ea91a2382a2ebe825c4ea6254fc0ec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/33d2d7fe1269b2301640c44cf2896ea607b30e3e",
"reference": "33d2d7fe1269b2301640c44cf2896ea607b30e3e",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/b37d160498ea91a2382a2ebe825c4ea6254fc0ec",
"reference": "b37d160498ea91a2382a2ebe825c4ea6254fc0ec",
"shasum": ""
},
"require": {
@ -495,15 +495,15 @@ @@ -495,15 +495,15 @@
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "12.0.0",
"doctrine/coding-standard": "13.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.2",
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan-phpunit": "2.0.3",
"phpstan/phpstan": "2.1.17",
"phpstan/phpstan-phpunit": "2.0.6",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "10.5.39",
"slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.10.2",
"phpunit/phpunit": "10.5.46",
"slevomat/coding-standard": "8.16.2",
"squizlabs/php_codesniffer": "3.13.1",
"symfony/cache": "^6.3.8|^7.0",
"symfony/console": "^5.4|^6.3|^7.0"
},
@ -562,7 +562,7 @@ @@ -562,7 +562,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/4.2.3"
"source": "https://github.com/doctrine/dbal/tree/4.2.4"
},
"funding": [
{
@ -578,7 +578,7 @@ @@ -578,7 +578,7 @@
"type": "tidelift"
}
],
"time": "2025-03-07T18:29:05+00:00"
"time": "2025-06-15T23:15:01+00:00"
},
{
"name": "doctrine/deprecations",
@ -630,16 +630,16 @@ @@ -630,16 +630,16 @@
},
{
"name": "doctrine/doctrine-bundle",
"version": "2.14.0",
"version": "2.15.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineBundle.git",
"reference": "ca6a7350b421baf7fbdefbf9f4993292ed18effb"
"reference": "d88294521a1bca943240adca65fa19ca8a7288c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/ca6a7350b421baf7fbdefbf9f4993292ed18effb",
"reference": "ca6a7350b421baf7fbdefbf9f4993292ed18effb",
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d88294521a1bca943240adca65fa19ca8a7288c6",
"reference": "d88294521a1bca943240adca65fa19ca8a7288c6",
"shasum": ""
},
"require": {
@ -666,9 +666,9 @@ @@ -666,9 +666,9 @@
"require-dev": {
"doctrine/annotations": "^1 || ^2",
"doctrine/cache": "^1.11 || ^2.0",
"doctrine/coding-standard": "^12",
"doctrine/coding-standard": "^13",
"doctrine/deprecations": "^1.0",
"doctrine/orm": "^2.17 || ^3.0",
"doctrine/orm": "^2.17 || ^3.1",
"friendsofphp/proxy-manager-lts": "^1.0",
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan-phpunit": "2.0.3",
@ -732,7 +732,7 @@ @@ -732,7 +732,7 @@
],
"support": {
"issues": "https://github.com/doctrine/DoctrineBundle/issues",
"source": "https://github.com/doctrine/DoctrineBundle/tree/2.14.0"
"source": "https://github.com/doctrine/DoctrineBundle/tree/2.15.0"
},
"funding": [
{
@ -748,7 +748,7 @@ @@ -748,7 +748,7 @@
"type": "tidelift"
}
],
"time": "2025-03-22T17:28:21+00:00"
"time": "2025-06-16T19:53:58+00:00"
},
{
"name": "doctrine/doctrine-migrations-bundle",
@ -1269,16 +1269,16 @@ @@ -1269,16 +1269,16 @@
},
{
"name": "doctrine/orm",
"version": "3.3.3",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/orm.git",
"reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7"
"reference": "4664373bd0668d71b40cc368b950de95e1dba2f8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7",
"reference": "1f1891d3e20ef9881e81c2f32c53e9dc88dfc9a7",
"url": "https://api.github.com/repos/doctrine/orm/zipball/4664373bd0668d71b40cc368b950de95e1dba2f8",
"reference": "4664373bd0668d71b40cc368b950de95e1dba2f8",
"shasum": ""
},
"require": {
@ -1353,9 +1353,9 @@ @@ -1353,9 +1353,9 @@
],
"support": {
"issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/3.3.3"
"source": "https://github.com/doctrine/orm/tree/3.4.0"
},
"time": "2025-05-02T17:42:51+00:00"
"time": "2025-06-14T11:47:14+00:00"
},
{
"name": "doctrine/persistence",

16
src/Twig/Components/SearchComponent.php

@ -23,7 +23,7 @@ final class SearchComponent @@ -23,7 +23,7 @@ final class SearchComponent
{
use DefaultActionTrait;
#[LiveProp(writable: true)]
#[LiveProp(writable: true, useSerializerForHydration: true)]
public string $query = '';
public array $results = [];
@ -41,8 +41,8 @@ final class SearchComponent @@ -41,8 +41,8 @@ final class SearchComponent
#[LiveProp]
public int $resultsPerPage = 12;
private const SESSION_KEY = 'last_search_results';
private const SESSION_QUERY_KEY = 'last_search_query';
private const string SESSION_KEY = 'last_search_results';
private const string SESSION_QUERY_KEY = 'last_search_query';
public function __construct(
private readonly FinderInterface $finder,
@ -53,13 +53,14 @@ final class SearchComponent @@ -53,13 +53,14 @@ final class SearchComponent
private readonly RequestStack $requestStack
)
{
$token = $this->tokenStorage->getToken();
$this->npub = $token?->getUserIdentifier();
}
public function mount(): void
{
if ($this->npub) {
$token = $this->tokenStorage->getToken();
$this->npub = $token?->getUserIdentifier();
if ($this->npub !== null) {
try {
$this->credits = $this->creditsManager->getBalance($this->npub);
$this->logger->info($this->credits);
@ -86,6 +87,9 @@ final class SearchComponent @@ -86,6 +87,9 @@ final class SearchComponent
#[LiveAction]
public function search(): void
{
$token = $this->tokenStorage->getToken();
$this->npub = $token?->getUserIdentifier();
$this->logger->info("Query: {$this->query}, npub: {$this->npub}");
if (empty($this->query)) {

Loading…
Cancel
Save