Skip to content

rgh-feature-descriptions - Extract svelte component#9632

Merged
fregante merged 3 commits into
mainfrom
svelte-the-return
May 29, 2026
Merged

rgh-feature-descriptions - Extract svelte component#9632
fregante merged 3 commits into
mainfrom
svelte-the-return

Conversation

@fregante

@fregante fregante commented May 29, 2026

Copy link
Copy Markdown
Member

@fregante fregante added the meta Related to Refined GitHub itself label May 29, 2026
@fregante fregante marked this pull request as ready for review May 29, 2026 07:10
import RelatedIssuesCount from '../helpers/related-issues-count.svelte';

// eslint-disable-next-line no-undef -- Global
const {id, meta}: {id: string; meta: FeatureMeta | undefined} = $props();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity, this PR keeps the component as is, accepting the data as props.

In the future I'll explore having the feature extract these values from the URL and update its contents autonomously for:

return {destroy: () => element.remove()};
};
</script>
<span use:mount></span>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully Svelte won't hate us for injecting random elements into the DOM, but this is the solution to React/dom-chef components reuse (which it's just the icons for 98% of the case)

{@html icon.outerHTML} would be an alternative but it doesn't offer the ability to append classes and change attributes, which we use a lot for icons.

Comment on lines +23 to +25
const container = <div />;
mount(Description, {target: container, props: {id, meta}});
anchor.before(container);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, Svelte components require an additional wrapper. If this becomes annoying/troublesome we can look into alternative solutions.

We could also look into this library to just be able to use custom elements, although loading a bunch of code is never my favorite solution: w3c/webextensions#210 (comment)

@fregante fregante merged commit 77c8d45 into main May 29, 2026
13 checks passed
@fregante fregante deleted the svelte-the-return branch May 29, 2026 07:27
'https://github.com/refined-github/refined-github/issues/new',
);
url.searchParams.set('template', '1_bug_report.yml');
url.searchParams.set('title', `\`${id}\` `);

@fregante fregante May 29, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh, Claude dropped all comments...

  • Restore comments in a followup PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

1 participant