Merge pull request #12483 from meteor/updating-solid-skeleton

Updating solid skeleton
This commit is contained in:
Gabriel Grubba
2023-01-31 12:40:13 -03:00
committed by GitHub
2 changed files with 23 additions and 7 deletions

View File

@@ -1,26 +1,36 @@
import { LinksCollection } from "../api/links";
import { createSignal, For } from "solid-js";
import { Tracker } from "meteor/tracker";
import { Meteor } from "meteor/meteor";
export const Info = () => {
const loading = Meteor.subscribe("links");
const [isLoading, setIsLoading] = createSignal(loading.ready());
const [links, setLinks] = createSignal([]);
Tracker.autorun(() => {
setIsLoading(loading.ready());
setLinks(LinksCollection.find().fetch());
});
if (isLoading()) {
return <div>Loading...</div>;
}
return (
<div>
<h2>Learn Meteor!</h2>
<ul>
<For each={links()}>{
(link) =>
<For each={links()}>
{(link) => (
<li>
<a href={link.url} target="_blank">{link.title}</a>
<a href={link.url} target="_blank">
{link.title}
</a>
</li>
}</For>
)}
</For>
</ul>
</div>
)
}
);
};

View File

@@ -28,4 +28,10 @@ Meteor.startup(async () => {
url: 'https://forums.meteor.com',
});
}
// We publish the entire Links collection to all clients.
// In order to be fetched in real-time to the clients
Meteor.publish('links', function () {
return LinksCollection.find();
});
});