mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #12483 from meteor/updating-solid-skeleton
Updating solid skeleton
This commit is contained in:
@@ -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>
|
||||
)
|
||||
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user