repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
ipyreact | github_2023 | others | 11 | widgetti | maartenbreddels | @@ -0,0 +1,882 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "d8ec9a76-0819-463d-8955-55789ee36400",
+ "metadata": {},
+ "source": [
+ "# Ipyreact walkthrough"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "083f2dc7-c0ec-482f-a720-aa2896ad1... | Link to traitlets? |
ipyreact | github_2023 | others | 11 | widgetti | maartenbreddels | @@ -0,0 +1,882 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "d8ec9a76-0819-463d-8955-55789ee36400",
+ "metadata": {},
+ "source": [
+ "# Ipyreact walkthrough"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "083f2dc7-c0ec-482f-a720-aa2896ad1... | Traitlets that are tagged with `sync=True` will be available not only on the Python side, but also in the frontend. |
ipyreact | github_2023 | others | 11 | widgetti | maartenbreddels | @@ -0,0 +1,882 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "d8ec9a76-0819-463d-8955-55789ee36400",
+ "metadata": {},
+ "source": [
+ "# Ipyreact walkthrough"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "083f2dc7-c0ec-482f-a720-aa2896ad1... | ```suggestion
"To access the value from the JavaScript side, we can use that all values are passed as a single object as first argument, so we can use [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#object_destructuring](object destructuring) to get access to t... |
ipyreact | github_2023 | others | 11 | widgetti | maartenbreddels | @@ -0,0 +1,882 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "d8ec9a76-0819-463d-8955-55789ee36400",
+ "metadata": {},
+ "source": [
+ "# Ipyreact walkthrough"
+ ]
+ },
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "083f2dc7-c0ec-482f-a720-aa2896ad1... | ```suggestion
"MyExampleWidget(my_message=\"Super Button\")"
``` |
mewz | github_2023 | others | 64 | mewz-project | saza-ku | @@ -651,9 +651,48 @@ pub fn integrationTest() void {
return;
}
+ if (!testReadfile()) {
+ return;
+ }
+
log.fatal.print("Integration test passed\n");
}
+fn testReadfile() bool {
+ @setRuntimeSafety(false);
+
+ // path_open
+ const fd_addr_in_linear_memory = 0;
+ const pa... | The argument of `size_addr` is the size of the content, not the size of the buffer.
This is set by `fd_read`. (https://github.com/mewz-project/mewz/blob/main/src/wasi.zig#L143)
So we need to pass other region of memory, for example `2048`. |
mewz | github_2023 | others | 64 | mewz-project | saza-ku | @@ -651,9 +651,48 @@ pub fn integrationTest() void {
return;
}
+ if (!testReadfile()) {
+ return;
+ }
+
log.fatal.print("Integration test passed\n");
}
+fn testReadfile() bool {
+ @setRuntimeSafety(false);
+
+ // path_open
+ const fd_addr_in_linear_memory = 0;
+ const pa... | Could you add verification of the content?
You can use [std.mem.eql](https://ziglang.org/documentation/master/std/#std.mem.eql) to compare two strings. |
mewz | github_2023 | others | 54 | mewz-project | ainozaki | @@ -5,6 +5,7 @@ const Ip4Address = std.os.linux.sockaddr;
const Params = struct {
addr: u32 = undefined,
subnetmask: u32 = undefined,
+ gateway: u32 = undefined, | Should we set default value rather than `undefined` ?
Or insert assertion before calling lwip? |
mewz | github_2023 | others | 4 | mewz-project | ainozaki | @@ -14,6 +14,8 @@ Mewz is **a specialized kernel designed for running Wasm**. Mewz runs a single W
## Quick Start
+There are some example programs. Please check out [examples](https://github.com/Mewz-project/Mewz-private/tree/main/examples). | Wrong URL? |
hishel | github_2023 | others | 269 | karpetrosyan | karpetrosyan | @@ -3,6 +3,7 @@
## development
- Ignore file not found error when cleaning up a file storage. (#264)
+- Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#268) | ```suggestion
- Fix `AssertionError` on `client.close()` when use SQLiteStorage. (#269)
``` |
hishel | github_2023 | others | 264 | karpetrosyan | karpetrosyan | @@ -1,5 +1,9 @@
# Changelog
+## development
+
+- Fix race condition on file storage cache clean. | ```suggestion
- Ignore file not found error when cleaning up a file storage. (#264)
``` |
hishel | github_2023 | python | 251 | karpetrosyan | karpetrosyan | @@ -160,6 +160,34 @@ def test_is_cachable_for_no_store():
assert not controller.is_cachable(request=request, response=response)
+def test_is_cachable_for_shared_cache():
+ controller = Controller(cache_private=False, allow_heuristics=True)
+
+ request = Request(b"GET", b"https://example.com", headers=[])... | It's okay, I like it |
hishel | github_2023 | python | 248 | karpetrosyan | karpetrosyan | @@ -156,6 +156,7 @@ async def handle_async_request(self, request: Request) -> Response:
url=normalized_url(res.url),
headers=res.headers,
stream=AsyncCacheStream(res.stream),
+ extensions=res.extensions, | I thought we decided to use the original request timeout/extensions, for the revalidation request, from [this comment](https://github.com/karpetrosyan/hishel/issues/247#issuecomment-2190779262) |
hishel | github_2023 | others | 240 | karpetrosyan | karpetrosyan | @@ -6,7 +6,7 @@ if [ -d '.venv' ] ; then
fi
export SOURCE_FILES="hishel tests"
-${PREFIX}ruff format $SOURCE_FILES --diff
-${PREFIX}ruff check $SOURCE_FILES
+${PREFIX}ruff format $SOURCE_FILES
+${PREFIX}ruff check --fix $SOURCE_FILES | I think, you need to run ./scripts/lint for fixing |
hishel | github_2023 | python | 240 | karpetrosyan | karpetrosyan | @@ -134,6 +134,14 @@ def handle_request(self, request: Request) -> Response:
)
final_response.read()
+
+ if self._controller.is_cachable(request=request, response=final_response):
+ metadata = Metadata( | I dont' think we need to create a new metadata here. The transport and pool implementations should be almost identical, in transports we do not create new metadata here |
hishel | github_2023 | python | 240 | karpetrosyan | karpetrosyan | @@ -181,13 +181,24 @@ async def handle_async_request(self, request: Request) -> Response:
# Merge headers with the stale response.
final_httpcore_response = self._controller.handle_validation_response(
- old_response=stored_response, new_response=httpcore_revalidat... | I guess we need to check, if the response code is 200, then call `store` with the new metadata (by passing metadata=None so it creates automatically) but if the response code is 304 then we should use `update_metadata` method, which is for updating the entries, without touching the `ttl`. Now we are reseting the metada... |
hishel | github_2023 | python | 240 | karpetrosyan | karpetrosyan | @@ -254,3 +254,71 @@ async def test_pool_caching_post_method():
response = await cache_pool.request("POST", "https://www.example.com", content=b"request-2")
assert response.status == 200
assert not response.extensions["from_cache"]
+
+
+@pytest.mark.anyio
+async def test_revalidat... | ```suggestion
current = 1440504000 # Mon, 25 Aug 2015 12:00:00 GMT
``` |
hishel | github_2023 | python | 182 | karpetrosyan | karpetrosyan | @@ -1,14 +1,24 @@
+import time
import typing as tp
from datetime import datetime, timedelta, timezone
from anyio import to_thread
+try:
+ from botocore.exceptions import ClientError
+except ImportError: # pragma: no cover
+ ClientError = Exception # type: ignore | When do we need this? |
hishel | github_2023 | python | 159 | karpetrosyan | karpetrosyan | @@ -110,27 +115,45 @@ def __init__(
clock: tp.Optional[BaseClock] = None,
allow_stale: bool = False,
always_revalidate: bool = False,
+ allow_unsafe_methods: bool = False,
key_generator: tp.Optional[tp.Callable[[Request], str]] = None,
):
+ self._allow_unsafe_metho... | ```suggestion
f"or by removing {method_string} from `cacheable_methods`."
``` |
hishel | github_2023 | python | 159 | karpetrosyan | karpetrosyan | @@ -33,17 +33,36 @@ def normalized_url(url: tp.Union[httpcore.URL, str, bytes]) -> str:
assert False, "Invalid type for `normalized_url`" # pragma: no cover
-def generate_key(request: httpcore.Request) -> str:
+def sync_generate_body_hash(request: httpcore.Request) -> str:
+ if isinstance(request.stream, t... | I am not sure I fully understand second part of this if. `isinstance(request.stream, (tp.Iterable, bytes))` |
hishel | github_2023 | python | 159 | karpetrosyan | karpetrosyan | @@ -33,17 +33,37 @@ def normalized_url(url: tp.Union[httpcore.URL, str, bytes]) -> str:
assert False, "Invalid type for `normalized_url`" # pragma: no cover
-def generate_key(request: httpcore.Request) -> str:
+def sync_generate_body_hash(request: httpcore.Request) -> str:
+ if isinstance(request.stream, t... | Let's keep the async and sync API's same and raise an exception here like we do in async version. |
hishel | github_2023 | python | 159 | karpetrosyan | karpetrosyan | @@ -1,22 +1,87 @@
+import typing as tp
+
+import pytest
from httpcore import Request
+from httpcore._models import ByteStream
from hishel._controller import get_updated_headers
from hishel._utils import (
+ async_generate_body_hash,
extract_header_values,
extract_header_values_decoded,
float_seco... | I think these two tests should also be the same |
hishel | github_2023 | python | 183 | karpetrosyan | umnovI | @@ -253,3 +253,30 @@ async def test_transport_with_wrong_type_of_storage():
controller=hishel.Controller(),
storage=storage, # type: ignore
)
+
+
+@pytest.mark.anyio
+async def test_transport_caching_post_method():
+ controller = hishel.Controller(cacheable_methods=["POST"])
+
+ ... | URL is different from
```python
request = httpx.Request("POST", "https://www.example.com", json={"request": 1})
``` |
hishel | github_2023 | python | 181 | karpetrosyan | karpetrosyan | @@ -18,3 +49,39 @@ def test_client_301():
"https://www.example.com",
)
assert response.extensions["from_cache"]
+
+
+
+@respx.mock
+def test_empty_cachefile_handling(hishel_client: hishel.CacheClient, clear_cache: None) -> None:
+ respx.get("https://example.com/").respond(
... | We use `use_temp_dir` fixture for such cases when we need to test file storages |
hishel | github_2023 | others | 181 | karpetrosyan | karpetrosyan | @@ -18,6 +18,7 @@ trio==0.24.0
coverage==7.4.1
types-PyYAML==6.0.12.12
moto[s3]==4.2.14
+respx==0.20.2 | Let's avoid introducing a new dependency. Instead, we can use mocking classes that hishel provides. See `MockTransport` and `MockAsyncTransport` |
hishel | github_2023 | python | 169 | karpetrosyan | karpetrosyan | @@ -128,10 +134,18 @@ async def retrieve(self, key: str) -> tp.Optional[StoredResponse]:
async def aclose(self) -> None: # pragma: no cover
return
- async def _remove_expired_caches(self) -> None:
+ async def _remove_expired_caches(self, response_path: Path) -> None:
if self._ttl is None... | ```suggestion
if time.time() - self._timer < self._check_ttl_every:
``` |
hishel | github_2023 | python | 169 | karpetrosyan | karpetrosyan | @@ -84,6 +88,8 @@ def __init__(
self._file_manager = AsyncFileManager(is_binary=self._serializer.is_binary)
self._lock = AsyncLock()
+ self._check_ttl_every = check_ttl_every
+ self._timer = time.time() | ```suggestion
self._timer = time.monolitic()
```
Let's use [monolitic](https://docs.python.org/3/library/time.html#time.monotonic) here |
hishel | github_2023 | python | 169 | karpetrosyan | karpetrosyan | @@ -67,13 +67,17 @@ class AsyncFileStorage(AsyncBaseStorage):
:type base_path: tp.Optional[Path], optional
:param ttl: Specifies the maximum number of seconds that the response can be cached, defaults to None
:type ttl: tp.Optional[tp.Union[int, float]], optional
+ :param check_ttl_every: How often in... | We can rename this to `vaccum_cache_every` or `clean_cache_every` |
hishel | github_2023 | python | 130 | karpetrosyan | karpetrosyan | @@ -127,6 +129,7 @@ def __init__(
self._allow_heuristics = allow_heuristics
self._allow_stale = allow_stale
self._always_revalidate = always_revalidate
+ self._key_generator = key_generator if key_generator else generate_key | ```suggestion
self._key_generator = key_generator or generate_key
``` |
hishel | github_2023 | others | 119 | karpetrosyan | karpetrosyan | @@ -3,6 +3,7 @@
## Unreleased
- Add `force_cache` extension to enforce the request to be cached, ignoring the HTTP headers. (#117)
+- Fix issue where sqlite storage cache get deleted immediately. (#118) | ```suggestion
- Fix issue where sqlite storage cache get deleted immediately. (#119)
``` |
hishel | github_2023 | others | 109 | karpetrosyan | karpetrosyan | @@ -1,5 +1,9 @@
# Changelog
+## Unreleased
+
+- Fix issue where freshness cannot be calculated to re-send request. (#104) | I think you've created this branch from another pull request. |
hishel | github_2023 | python | 109 | karpetrosyan | karpetrosyan | @@ -773,3 +773,16 @@ def test_must_understand_response_directive():
controller = Controller()
assert controller.is_cachable(request=request, response=response)
+
+
+def test_freshness_lifetime_invalid_information():
+ controller = Controller()
+ response = Response(
+ status=400,
+ )
+ or... | This test also from previous pull request |
hishel | github_2023 | python | 109 | karpetrosyan | karpetrosyan | @@ -72,6 +72,16 @@ async def handle_async_request(self, request: Request) -> Response:
:return: An HTTP response
:rtype: httpx.Response
"""
+
+ if request.extensions.get("cache_disabled", False):
+ request.headers.update(
+ [
+ ("Cache-Contr... | I have added this to not lose the existing cache-control values. |
hishel | github_2023 | others | 109 | karpetrosyan | karpetrosyan | @@ -0,0 +1,63 @@
+---
+icon: material/apps
+---
+
+`HTTPX` provides an extension mechanism to allow additional information
+to be added to requests and to be returned in responses. `hishel` makes use
+of these extensions to expose some additional cache-related options and metadata.
+These extensions are available from... | ```suggestion
extension temporarily disables the cache by passing appropriate RFC9111 headers to
``` |
hishel | github_2023 | others | 109 | karpetrosyan | karpetrosyan | @@ -0,0 +1,63 @@
+---
+icon: material/apps
+---
+
+`HTTPX` provides an extension mechanism to allow additional information
+to be added to requests and to be returned in responses. `hishel` makes use
+of these extensions to expose some additional cache-related options and metadata.
+These extensions are available from... | Let's avoid specifying how many extensions we currently support; I believe it will complicate the maintenance process (we will need to change it with each extension).
Instead, we can do something similar to the headers documentation we have, see the [doc](https://hishel.com/advanced/http_headers/) (simple, minimalisti... |
hishel | github_2023 | others | 109 | karpetrosyan | karpetrosyan | @@ -211,3 +211,49 @@ with httpcore.ConnectionPool() as pool:
cache_pool.get("https://example.com/cachable-endpoint")
response = cache_pool.get("https://example.com/cachable-endpoint") # from the cache
```
+
+### Temporarily Disabling the Cache
+ | I believe this section could be removed. if we want to include references to extensions, headers, or other sections, we will do so in a single pull request as part of a documentation refactoring. |
hishel | github_2023 | others | 109 | karpetrosyan | karpetrosyan | @@ -3,6 +3,8 @@
## Unreleased
- Fix issue where freshness cannot be calculated to re-send request. (#104)
+- Add `cache_disabled` extension to temporarily disable the cache (#109)
+- Document response and requests extensions (#109) | We do not need to add a changelog related to documentation and tests. They are not user-facing changes.
```suggestion
``` |
hishel | github_2023 | python | 110 | karpetrosyan | karpetrosyan | @@ -6,7 +6,7 @@
from ._headers import *
from ._serializers import *
from ._sync import *
-
+from ._controller import HEURISTICALLY_CACHEABLE_STATUS_CODES | ```suggestion
from ._controller import HEURISTICALLY_CACHEABLE_STATUS_CODES
``` |
hishel | github_2023 | python | 110 | karpetrosyan | karpetrosyan | @@ -13,7 +13,7 @@
parse_date,
)
-HEURISTICALLY_CACHABLE = (200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, 501)
+HEURISTICALLY_CACHEABLE_STATUS_CODES = (200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, 501)
__all__ = ("Controller",) | ```suggestion
__all__ = ("Controller", "HEURISTICALLY_CACHEABLE_STATUS_CODES")
``` |
hishel | github_2023 | others | 110 | karpetrosyan | karpetrosyan | @@ -3,6 +3,7 @@
## Unreleased
- Fix issue where freshness cannot be calculated to re-send request. (#104)
+- Add documentation for heuristic caching noting heuristically cacheable status codes, and made `HEURISTICALLY_CACHEABLE_STATUS_CODES` importable from `hishel` (#110) | ```suggestion
``` |
hishel | github_2023 | others | 110 | karpetrosyan | karpetrosyan | @@ -53,6 +53,24 @@ client = hishel.CacheClient(controller=controller)
```
+
+
+`Hishel` is very conservative about what status codes are permitted
+to be heuristically cacheable. When `allow_heuristics` is enabled,
+`Hishel` will only cache responses having status codes 200, 301, and 308. In contrast, RFC 9111 spe... | ```suggestion
`Hishel` will only cache responses having status codes 200, 301, and 308. In contrast, RFC 9111 specifies that many more responses can be heuristically cacheable, specifically 200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, and 501.
If you would prefer heuristic caching to the fullest extent p... |
hishel | github_2023 | others | 110 | karpetrosyan | karpetrosyan | @@ -53,6 +53,26 @@ client = hishel.CacheClient(controller=controller)
```
+
+ | ```suggestion
``` |
hishel | github_2023 | others | 105 | karpetrosyan | karpetrosyan | @@ -1,5 +1,10 @@
# Changelog
+## 0.0.18 (9/11/2023)
+
+- Fix issue where freshness cannot be calculated to re-send request (#104) | ```suggestion
``` |
hishel | github_2023 | python | 104 | karpetrosyan | karpetrosyan | @@ -317,7 +317,9 @@ def construct_response_from_cache(
response=response, clock=self._clock
)
else: # pragma: no cover | ```suggestion
else:
``` |
hishel | github_2023 | others | 104 | karpetrosyan | karpetrosyan | @@ -1,5 +1,9 @@
# Changelog
+## 0.0.18 (9/11/2023)
+
+- Fix issue where freshness cannot be calculated to re-send request (#104) | ```suggestion
- Fix issue where freshness cannot be calculated to re-send request. (#104)
``` |
hishel | github_2023 | others | 104 | karpetrosyan | karpetrosyan | @@ -1,5 +1,9 @@
# Changelog
+## 0.0.18 (9/11/2023) | ```suggestion
## Unreleased
```
|
hishel | github_2023 | python | 104 | karpetrosyan | karpetrosyan | @@ -773,3 +773,15 @@ def test_must_understand_response_directive():
controller = Controller()
assert controller.is_cachable(request=request, response=response)
+ | ```suggestion
```
|
hishel | github_2023 | python | 104 | karpetrosyan | karpetrosyan | @@ -773,3 +773,14 @@ def test_must_understand_response_directive():
controller = Controller()
assert controller.is_cachable(request=request, response=response)
+def test_freshness_lifetime_invalid_information(): | ```suggestion
def test_freshness_lifetime_invalid_information():
```
|
hishel | github_2023 | python | 104 | karpetrosyan | karpetrosyan | @@ -773,3 +773,16 @@ def test_must_understand_response_directive():
controller = Controller()
assert controller.is_cachable(request=request, response=response)
+
+
+def test_freshness_lifetime_invalid_information():
+ controller = Controller()
+ response = Response(
+ status=400,
+ )
+ or... | ```suggestion
assert isinstance(conditional_request, Request)
```
|
shadcn-svelte | github_2023 | typescript | 1,616 | huntabyte | huntabyte | @@ -1,27 +1,9 @@
-import { untrack } from "svelte";
+import { MediaQuery } from "svelte/reactivity";
const MOBILE_BREAKPOINT = 768;
-export class IsMobile {
- #current = $state<boolean>(false);
-
+export class IsMobile extends MediaQuery {
constructor() {
- $effect(() => {
- return untrack(() => {
- const ... | I don't believe Svelte's `MediaQuery` expects you to wrap it in parenthesis, right? |
shadcn-svelte | github_2023 | others | 1,446 | huntabyte | huntabyte | @@ -0,0 +1,154 @@
+---
+title: Svelte 5 Migration
+description: How to migrate to Svelte 5 from Svelte 4.
+---
+
+## Prerequisites
+
+1. Make sure you have read up on the changes from Svelte 4 to Svelte 5. Svelte provides a comprehensive guide for this on their [website](https://svelte.dev/docs/svelte/v5-migration-guid... | ```suggestion
1. Ensure you have read up on the changes from Svelte 4 to Svelte 5. Svelte provides a comprehensive guide for this on their [website](https://svelte.dev/docs/svelte/v5-migration-guide).
``` |
shadcn-svelte | github_2023 | others | 1,446 | huntabyte | huntabyte | @@ -0,0 +1,154 @@
+---
+title: Svelte 5 Migration
+description: How to migrate to Svelte 5 from Svelte 4.
+---
+
+## Prerequisites
+
+1. Make sure you have read up on the changes from Svelte 4 to Svelte 5. Svelte provides a comprehensive guide for this on their [website](https://svelte.dev/docs/svelte/v5-migration-guid... | ```suggestion
2. Commit any pending changes so that you don't lose any code.
``` |
shadcn-svelte | github_2023 | others | 1,446 | huntabyte | huntabyte | @@ -0,0 +1,154 @@
+---
+title: Svelte 5 Migration
+description: How to migrate to Svelte 5 from Svelte 4.
+---
+
+## Prerequisites
+
+1. Make sure you have read up on the changes from Svelte 4 to Svelte 5. Svelte provides a comprehensive guide for this on their [website](https://svelte.dev/docs/svelte/v5-migration-guid... | ```suggestion
3. Determine which of your components have custom behavior/styles so you can reimplement those after updating.
``` |
shadcn-svelte | github_2023 | others | 1,446 | huntabyte | huntabyte | @@ -0,0 +1,154 @@
+---
+title: Svelte 5 Migration
+description: How to migrate to Svelte 5 from Svelte 4.
+---
+
+## Prerequisites
+
+1. Make sure you have read up on the changes from Svelte 4 to Svelte 5. Svelte provides a comprehensive guide for this on their [website](https://svelte.dev/docs/svelte/v5-migration-guid... | ```suggestion
Add the `registry` to the root object, and add `hooks` and `ui` keys under `aliases`.
``` |
shadcn-svelte | github_2023 | typescript | 1,336 | huntabyte | AdrianGonz97 | @@ -105,7 +106,7 @@ export function getTSConfig(cwd: string, tsconfigName: "tsconfig.json" | "jsconf
const parsedConfig = getTsconfig(path.resolve(cwd, "package.json"), tsconfigName);
if (parsedConfig === null) {
throw error(
- `Failed to find ${highlight(tsconfigName)}. See: ${color.underline("https://www.sha... | ```suggestion
`Failed to find ${highlight(tsconfigName)}. See: ${color.underline(`${SITE_BASE_URL}/docs/installation#opt-out-of-typescript`)}`
``` |
shadcn-svelte | github_2023 | others | 1,217 | huntabyte | benmccann | @@ -16,7 +16,7 @@ description: How to setup shadcn-svelte manually.
Use the `svelte-add` CLI to add Tailwind CSS to your project.
```bash
-npx @svelte-add/tailwindcss@latest
+npx svelte-add@latest tailwindcss | I've been using it without `@latest` and it's been working just fine since we started pinning the dependency versions |
shadcn-svelte | github_2023 | others | 1,186 | huntabyte | huntabyte | @@ -33,8 +33,15 @@ Usage: shadcn-svelte init [options]
initialize your project and install dependencies
Options:
- -c, --cwd <cwd> the working directory. (default: the current directory)
- -h, --help display help for command
+ -c, --cwd <cwd> the working directory. defaults to the current d... | ```suggestion
-c, --cwd <cwd> the working directory. defaults to the current directory.
``` |
shadcn-svelte | github_2023 | typescript | 1,093 | huntabyte | AdrianGonz97 | @@ -1,6 +1,14 @@
import process from "node:process";
export function getEnvProxy(): string | undefined {
- const { HTTP_PROXY, http_proxy } = process.env;
- return HTTP_PROXY || http_proxy;
+ const { env } = process;
+ return (
+ env.HTTP_PROXY ||
+ env.http_proxy ||
+ env.HTTPS_PROXY ||
+ env.https_proxy ||
+ ... | ```suggestion
```
This doesn't seem to be a valid npm config option: https://docs.npmjs.com/cli/v10/using-npm/config#proxy
the other two are fine though |
shadcn-svelte | github_2023 | others | 1,093 | huntabyte | AdrianGonz97 | @@ -110,6 +112,11 @@ Options:
## Outgoing Requests
-### proxy
+### Proxy
-A proxy to use for outgoing request to fetch from `shadcn` registry. If `HTTP_PROXY` or `http_proxy` environment variables are set, the underlying request library will honor proxy settings.
+This enables the use of a proxy when sending out... | prefer to keep these on a single line:
```suggestion
This enables the use of a proxy when sending out requests to fetch from the `shadcn` registry. If the `HTTP_PROXY` or `http_proxy` environment variables have been set, the request library underneath will respect the proxy settings.
``` |
shadcn-svelte | github_2023 | others | 1,093 | huntabyte | AdrianGonz97 | @@ -7,7 +7,8 @@ description: Use the CLI to add components to your project.
Use the `init` command to initialize dependencies for a new project.
-The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.cjs`, and creates CSS variables for the project.
+The `init` command installs d... | ```suggestion
The `init` command installs dependencies, adds the `cn` util, configures `tailwind.config.cjs`, and creates CSS variables for the project.
``` |
shadcn-svelte | github_2023 | others | 1,093 | huntabyte | AdrianGonz97 | @@ -85,7 +86,8 @@ Options:
## update
-Use the `update` command to update components in your project. This will overwrite any modifications you've made to the components, so be sure to commit your changes before running this command.
+Use the `update` command to update components in your project. This will overwrit... | ```suggestion
Use the `update` command to update components in your project. This will overwrite any modifications you've made to the components, so be sure to commit your changes before running this command.
``` |
shadcn-svelte | github_2023 | typescript | 959 | huntabyte | huntabyte | @@ -61,15 +67,11 @@ export async function highlightCode(code: string) {
if (!highlighter) {
highlighter = await getHighlighter({
langs: ["svelte"],
- themes: [],
- });
- await highlighter.loadTheme({
- ...lambdaStudioBlackout,
- name: "Lambda Studio - Blackout",
+ themes: [lambdaStudioBlackout], | urgg this wasn't working for me when I tried π |
shadcn-svelte | github_2023 | others | 959 | huntabyte | huntabyte | @@ -1,9 +1,15 @@
<script lang="ts">
+ import { Index } from "$lib/../__registry__/index.js";
+ import type { ComponentType } from "svelte";
import type { PageData } from "./$types.js";
export let data: PageData;
+
+ $: component = Index[data.block.style][data.block.name]?.component() as Promise<ComponentType>;
... | 5head |
shadcn-svelte | github_2023 | typescript | 959 | huntabyte | huntabyte | @@ -1,5 +1,5 @@
export const lambdaStudioBlackout: Record<string, unknown> = {
- name: "Lambda Studio β Blackout",
+ name: "Lambda Studio - Blackout", | Ahh, this is why it wasn't working for me! |
shadcn-svelte | github_2023 | typescript | 938 | huntabyte | huntabyte | @@ -63,7 +63,7 @@ async function detect(cwd: string) {
}
// detect based on lock
- if (!agent && lockPath) agent = LOCKS[path.basename(lockPath)];
+ if (!agent && lockPath) agent = LOCKS[path.basename(lockPath)]!; | Don't think I didn't see this... ;) |
shadcn-svelte | github_2023 | others | 915 | huntabyte | AdrianGonz97 | @@ -0,0 +1,5 @@
+---
+"shadcn-svelte": patch
+---
+
+fix: Fix line of log incorrectly showing | ```suggestion
fix: Fixed component update warning and malformed filename for `utils`
``` |
shadcn-svelte | github_2023 | others | 848 | huntabyte | huntabyte | @@ -9,30 +9,33 @@
<Popover.Trigger asChild let:builder>
<Button builders={[builder]} variant="outline">Open</Button>
</Popover.Trigger>
- <Popover.Content class="w-80">
- <div class="grid gap-4">
- <div class="space-y-2">
- <h4 class="font-medium leading-none">Dimensions</h4>
- <p class="text-sm text-mu... | We don't need this in the example. |
shadcn-svelte | github_2023 | others | 699 | huntabyte | huntabyte | @@ -106,7 +106,7 @@
}}
>
<Command.Item
- value={model.name}
+ value={model.id} | This breaks the ability to search, try typing in `text` into the searchbar and you'll see.
```suggestion
value={model.name}
```
What we should do instead to enable models to be selected is to update the `onSelect` callback to:
```ts
onSelect(() => {
value = model.id
closeAndFocusTrigger(id... |
shadcn-svelte | github_2023 | others | 699 | huntabyte | huntabyte | @@ -73,8 +73,8 @@
<div class="grid gap-2">
<Label for="security-level">Security Level</Label>
<Select.Root selected={securityLevels[1]}>
- <Select.Trigger id="security-level">
- <Select.Value placeholder="Select level" />
+ <Select.Trigger>
+ <Select.Value placeholder="Select level" id="... | ```suggestion
<Select.Value placeholder="Select level" />
```
The `value` shouldn't get an id. |
shadcn-svelte | github_2023 | javascript | 675 | huntabyte | huntabyte | @@ -181,13 +195,10 @@ function rehypeComponentPreToPre() {
if (node?.type === "element" && node?.tagName === "Components.pre") {
node.tagName = "pre";
}
-
- if (node?.type === "element" && node?.tagName === "pre") {
- //
- }
}); | Thanks for the cleanup! |
shadcn-svelte | github_2023 | others | 675 | huntabyte | huntabyte | @@ -2,12 +2,52 @@
import { clickToCopyAction } from "svelte-legos";
import { cn } from "$lib/utils";
import { Check, Copy } from "radix-icons-svelte";
+ import { Button } from "@/registry/default/ui/button";
+ import * as DropdownMenu from "@/registry/default/ui/dropdown-menu";
let copied = false;
+ let comma... | ```suggestion
yarn: value.replace("npx create ", "yarn create "),
pnpm: value.replace("npx create ", "pnpm create "),
bun: value.replace("npx create ", "bunx --bun")
```
I'm not seeing anywhere that a `-` follows create, so I think this is causing the `npm create svelte@latest my-app` block to not wo... |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -1,11 +1,12 @@
<script lang="ts">
import type { TableOfContents } from "$lib/types/docs";
- import { page } from "$app/stores";
import { cn } from "$lib/utils";
export let tree: TableOfContents = {
items: []
};
+ console.log(tree); | ```suggestion
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -26,10 +26,16 @@
{...builder}
use:builder.action
on:click={() => {
- config.update((prev) => ({
- ...prev,
- theme: theme.name
- }));
+ config.update(
+ (prev) => (
+ console.log("prev", prev),
+ console.log("theme", th... | ```suggestion
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -52,13 +53,59 @@
filteredHeadingsList = hierarchy;
}
+ const activeItem = writable<string | undefined>(undefined);
+
+ function useActiveItem(itemIds: string[]) {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) {
+ $active... | ```suggestion
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -52,13 +53,59 @@
filteredHeadingsList = hierarchy;
}
+ const activeItem = writable<string | undefined>(undefined);
+
+ function useActiveItem(itemIds: string[]) {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) {
+ $active... | ```suggestion
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -52,13 +53,59 @@
filteredHeadingsList = hierarchy;
}
+ const activeItem = writable<string | undefined>(undefined);
+
+ function useActiveItem(itemIds: string[]) {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) {
+ $active... | I think we need to return this from the `onMount` to make sure the observers get cleaned up, since `useActiveItem` is returning a function, we need to invoke it
```suggestion
return useActiveItem(allItemIds);
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -11,9 +11,10 @@
{#each items as item, index (index)}
{#if item.href}
<a
+ data-sveltekit-keepfocus | Why do we want this here?
According to https://kit.svelte.dev/docs/link-options#data-sveltekit-keepfocus we shouldn't use them for links. If there's a specific reasoning let me know! |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -2,18 +2,24 @@
import Balancer from "svelte-wrap-balancer";
import { cn } from "$lib/utils";
+ export let balancer: boolean | undefined = true; | ```suggestion
export let balanced = true;
``` |
shadcn-svelte | github_2023 | others | 629 | huntabyte | huntabyte | @@ -2,18 +2,24 @@
import Balancer from "svelte-wrap-balancer";
import { cn } from "$lib/utils";
+ export let balancer: boolean | undefined = true;
+
let className: string | undefined | null = undefined;
export { className as class };
</script>
<p
class={cn(
- "max-w-[750px] text-lg text-muted-foregroun... | ```suggestion
{#if balanced}
``` |
shadcn-svelte | github_2023 | others | 452 | huntabyte | leonardsimonse | @@ -49,6 +49,13 @@
class="text-muted-foreground"
>
{item.title}
+ {#if item.label}
+ <span
+ class="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline" | Isn't `group-hover:no-underline` redundant as `no-underline` already has the same effect? |
shadcn-svelte | github_2023 | others | 393 | huntabyte | huntabyte | @@ -55,15 +55,13 @@ By default, the `<Card.Title>` component renders an `<h3>` element. You can chan
For example:
```svelte
-<Card.Title tag="h2">This will render an H2</Card.Title>
+<Card.Title tag="h1">This will render an H2</Card.Title>
```
-```svelte
-<Card.Title tag="h5">This will render an H5</Card.Title>
... | ```suggestion
<Card.Title tag="h5">This will render an H5</Card.Title>
``` |
shadcn-svelte | github_2023 | others | 371 | huntabyte | huntabyte | @@ -18,7 +18,7 @@
{disabled}
{label}
class={cn(
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex w-full cursor-default se... | We shouldn't need `hover` classes here.
You also forgot to remove `focus` from one of the highlighted selectors π
should be - `data-[highlighted]:text-accent-foreground` |
shadcn-svelte | github_2023 | others | 371 | huntabyte | huntabyte | @@ -18,7 +18,7 @@
{disabled}
{label}
class={cn(
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative fle... | Same here, I don't think we need hover classes as highlighted should handle hover events and it can be weird if you leave your mouse on one item and then use your keyboard to navigate down, it will technically show two items as highlighted. |
shadcn-svelte | github_2023 | others | 307 | huntabyte | huntabyte | @@ -7,7 +7,7 @@
<Checkbox id="terms" disabled />
<Label
for="terms2"
- class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 peer-data-[disabled=true]:cursor-not-allo... | I think you should be able to do `peer-data-[disabled]:cursor-not-allowed`, etc., as if I remember correctly we don't set that property at all if it _isn't_ disabled. |
vaul-svelte | github_2023 | others | 15 | huntabyte | huntabyte | @@ -0,0 +1,188 @@
+<!-- Nested Drawer Example -->
+<script lang="ts">
+ import { Drawer } from '$lib/index.ts'; | ```suggestion
import { Drawer } from '$lib/index.js';
``` |
vaul-svelte | github_2023 | others | 15 | huntabyte | huntabyte | @@ -0,0 +1,56 @@
+<!-- SCROLLABLE DRAWER -->
+<script lang="ts">
+ import { Drawer } from '$lib/index.ts'; | ```suggestion
import { Drawer } from '$lib/index.js';
``` |
vaul-svelte | github_2023 | others | 15 | huntabyte | huntabyte | @@ -0,0 +1,155 @@
+<!-- Snap Points Drawer -->
+<script lang="ts">
+ import { Drawer } from '$lib/index.ts'; | ```suggestion
import { Drawer } from '$lib/index.js';
``` |
bits-ui | github_2023 | typescript | 1,071 | huntabyte | huntabyte | @@ -71,45 +64,13 @@ export const MenuOpenEvent = new CustomEventDispatcher("bitsmenuopen", {
class MenuRootState {
onClose: MenuRootStateProps["onClose"];
variant: MenuRootStateProps["variant"];
- isUsingKeyboard = $state(false);
+ isUsingKeyboard = new IsUsingKeyboard();
dir: MenuRootStateProps["dir"];
cons... | Nice catch on this one :) |
bits-ui | github_2023 | typescript | 1,071 | huntabyte | huntabyte | @@ -0,0 +1,69 @@
+import { type AnyFn, addEventListener, executeCallbacks } from "svelte-toolbelt";
+
+// Using global state to avoid multiple listeners.
+let isUsingKeyboard = $state(false);
+
+export class IsUsingKeyboard {
+ static _refs = 0; // Reference counting to avoid multiple listeners.
+ static _cleanup?: Any... | Any particular reason you went with `addEventListener` vs `on` from Svelte? I know I have both in the project but would like to eventually remove `addEventListener` in favor of `on` |
bits-ui | github_2023 | others | 686 | huntabyte | huntabyte | @@ -43,7 +43,7 @@ You can then use those data attributes like so:
import "../app.pcss";
</script>
-<slot />
+<slot></slot> | We should update this to use `snippets` probably! |
bits-ui | github_2023 | others | 632 | huntabyte | huntabyte | @@ -16,4 +16,202 @@ description: Displays a menu of items that users can select from when triggered.
</ComponentPreviewV2>
+## Structure
+
+```svelte
+<script lang="ts">
+ import { DropdownMenu } from "bits-ui";
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger />
+
+ <DropdownMenu.Content>
+ <DropdownMen... | ```suggestion
<DropdownMenu.Group>
<DropdownMenu.GroupLabel />
```
In previous versions of this, we weren't appropriately requiring a label to be associated with a group, which is confusing. In Svelte 5, if you're using a `GroupLabel`, it must be within either a `DropdownMenu.Group` or `DropdownMenu.RadioGrou... |
bits-ui | github_2023 | others | 632 | huntabyte | huntabyte | @@ -16,4 +16,202 @@ description: Displays a menu of items that users can select from when triggered.
</ComponentPreviewV2>
+## Structure
+
+```svelte
+<script lang="ts">
+ import { DropdownMenu } from "bits-ui";
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger />
+
+ <DropdownMenu.Content>
+ <DropdownMen... | We should add a label here or at least expose an `aria-label` property to apply to the group π |
bits-ui | github_2023 | others | 632 | huntabyte | huntabyte | @@ -16,4 +16,202 @@ description: Displays a menu of items that users can select from when triggered.
</ComponentPreviewV2>
+## Structure
+
+```svelte
+<script lang="ts">
+ import { DropdownMenu } from "bits-ui";
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger />
+
+ <DropdownMenu.Content>
+ <DropdownMen... | In this case `textValue === item.label`. `textValue` is only necessary if you have some complex content within the item and is only used for typeahead purposes |
bits-ui | github_2023 | others | 632 | huntabyte | huntabyte | @@ -16,4 +16,202 @@ description: Displays a menu of items that users can select from when triggered.
</ComponentPreviewV2>
+## Structure
+
+```svelte
+<script lang="ts">
+ import { DropdownMenu } from "bits-ui";
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger />
+
+ <DropdownMenu.Content>
+ <DropdownMen... | ```suggestion
You can create nested menus using the `DropdownMenu.Sub` component to create complex menu structures.
``` |
bits-ui | github_2023 | others | 632 | huntabyte | huntabyte | @@ -16,4 +16,202 @@ description: Displays a menu of items that users can select from when triggered.
</ComponentPreviewV2>
+## Structure
+
+```svelte
+<script lang="ts">
+ import { DropdownMenu } from "bits-ui";
+</script>
+
+<DropdownMenu.Root>
+ <DropdownMenu.Trigger />
+
+ <DropdownMenu.Content>
+ <DropdownMen... |
```suggestion
```svelte /DropdownMenu.Sub/
``` |
bits-ui | github_2023 | others | 525 | huntabyte | AdrianGonz97 | @@ -58,6 +58,6 @@
"nanoid": "^5.0.5"
},
"peerDependencies": {
- "svelte": "^4.0.0"
+ "svelte": "^4.0.0 || ^5.0.0" | `^5.0.0` works with pnpm, but not with npm. We must use `-next.X`
```suggestion
"svelte": "^4.0.0 || ^5.0.0-next.118"
``` |
bits-ui | github_2023 | typescript | 461 | huntabyte | huntabyte | @@ -249,27 +223,18 @@ class AccordionTriggerState {
if (!candidateItems.length) return;
const currentIndex = candidateItems.indexOf(itemEl);
-
- switch (e.key) {
- case kbd.ARROW_DOWN:
- candidateItems[(currentIndex + 1) % candidateItems.length]?.focus();
- return;
- case kbd.ARROW_UP:
- candidate... | π₯ |
bits-ui | github_2023 | others | 430 | huntabyte | AdrianGonz97 | @@ -46,7 +46,7 @@
on:pointerleave
>
<slot {builder} {isSelected}>
- {label ? label : value}
+ {label || value} | should this be falsy or nullish? should the value be shown when `label = ""`? |
bits-ui | github_2023 | others | 430 | huntabyte | AdrianGonz97 | @@ -44,7 +43,7 @@
on:pointerleave
>
<slot {builder} {isSelected}>
- {label ? label : value}
+ {label || value} | same here for falsy or nullish |
bits-ui | github_2023 | others | 430 | huntabyte | AdrianGonz97 | @@ -21,6 +21,6 @@
<slot {label} {attrs} />
{:else}
<span bind:this={el} {...$$restProps} {...attrs} data-placeholder={!label ? "" : undefined}>
- {label ? label : placeholder}
+ {label || placeholder} | falsy or nullish? |
bits-ui | github_2023 | others | 277 | huntabyte | AdrianGonz97 | @@ -9,7 +9,8 @@
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
- "moduleResolution": "Bundler",
+ "module": "NodeNext", | I don't think this is required, despite the error that appears in the config. SvelteKit already sets `module` to `esnext` in the `tsconfig.json` this config extends from. They also don't include this option in their package template in `create-svelte`.
```suggestion
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.